chenybin 请进 ( 积分: 50 )

  • 主题发起人 主题发起人 huxhang
  • 开始时间 开始时间
H

huxhang

Unregistered / Unconfirmed
GUEST, unregistred user!
//用execl打开网页,http://www.mso.com.cn/odds/odds_eur_board.asp?id=177587
为何不行?谢!
procedure TForm1.SpeedButton6Click(Sender: TObject);
var
Excel: OleVariant;
ovDoc, ovInput, ovTag, ovIMG: OleVariant;
I : Integer;
begin
if not FDownComplete then Application.MessageBox('网页正在下载中,请稍后……', '提示', MB_OK + MB_ICONINFORMATION)
else begin
ovDoc := WebBrowser_M2.Document;
ovInput := ovDoc.all.tags('INPUT');
ovIMG := ovDoc.all.tags('IMG');
for I := 0 to ovInput.length -1 do begin
ovTag := ovInput.item(I);
if (ovTag.Type ='text') or (ovTag.Type ='password') or (ovTag.Type ='image') then begin
if ovTag.Name ='username' then ovTag.Value :=Edit_user.TEXT;
if ovTag.Name ='password' then
begin
ovTag.Value :=Edit_pw.TEXT;
end;
if ovTag.Type ='Submit' then begin
if ovTag.tabIndex=3 then
ovTag.Click;
end;
end;
end;
end;

try
Excel := CreateOLEObject('Excel.Application');
except
Exit;
end;
try
try
Excel.WorkBooks.Open('http://www.mso.com.cn/odds/odds_eur_board.asp?id=177587');
except
showmessage('err');
end;
finally
Excel.ActiveWorkbook.SaveAs('d:/11.xls');
Excel.Quit;
excel:=unassigned;
end;
end;
 
//用execl打开网页,http://www.mso.com.cn/odds/odds_eur_board.asp?id=177587
为何不行?谢!
procedure TForm1.SpeedButton6Click(Sender: TObject);
var
Excel: OleVariant;
ovDoc, ovInput, ovTag, ovIMG: OleVariant;
I : Integer;
begin
if not FDownComplete then Application.MessageBox('网页正在下载中,请稍后……', '提示', MB_OK + MB_ICONINFORMATION)
else begin
ovDoc := WebBrowser_M2.Document;
ovInput := ovDoc.all.tags('INPUT');
ovIMG := ovDoc.all.tags('IMG');
for I := 0 to ovInput.length -1 do begin
ovTag := ovInput.item(I);
if (ovTag.Type ='text') or (ovTag.Type ='password') or (ovTag.Type ='image') then begin
if ovTag.Name ='username' then ovTag.Value :=Edit_user.TEXT;
if ovTag.Name ='password' then
begin
ovTag.Value :=Edit_pw.TEXT;
end;
if ovTag.Type ='Submit' then begin
if ovTag.tabIndex=3 then
ovTag.Click;
end;
end;
end;
end;

try
Excel := CreateOLEObject('Excel.Application');
except
Exit;
end;
try
try
Excel.WorkBooks.Open('http://www.mso.com.cn/odds/odds_eur_board.asp?id=177587');
except
showmessage('err');
end;
finally
Excel.ActiveWorkbook.SaveAs('d:/11.xls');
Excel.Quit;
excel:=unassigned;
end;
end;
 
后退
顶部