book381 发表于 2003-1-23 01:23:00

[求助]excel控制IE

我想从excel 向IE 发送键击。控制IE ,具体讲是在IE的地址栏里输入“www.yahoo.com”,写了两个工程.都实现不了,请大家帮忙看看,谢谢。
代码1如下:

Sub xx()



Dim RetVal
RetVal = Shell("C:\Program Files\Internet Explorer\Iexplore.exe", 1)
SendKeys "{TAB}", True
SendKeys "www.yahoo.com", True
SendKeys "{ENTER}", True

End Sub

代码2如下:

Sub aaa()



Dim ie As Excel.Application


Set ie = CreateObject("Excel.Application")
ActiveWorkbook.FollowHyperlink Address:="file:///D:/软件库-D/tt.htm", _
NewWindow:=False, AddHistory:=True
Application.WindowState = xlNormal
SendKeys "{TAB}", True
SendKeys "www.yahoo.com", True
SendKeys "{ENTER}", True
ie.Visible = True

Application.Visible = True






End Sub

mccad 发表于 2003-1-23 09:06:00

试试引用Microsoft Internet Controls控件

页: [1]
查看完整版本: [求助]excel控制IE