我找到並修改了Excel VBA代碼以打開網頁並打開鏈接文件。Excel 2003 VBA代碼在逐步執行時工作,但在完全運行時不起作用
它可以在我遍歷它時運行,但當它完全運行時它不會打開文件。
Sub CallWebPage()
Dim URL As String
Dim ieApp As Object
Dim ieDoc As Object
Dim ieForm As Object
Dim ieObj As Object
Dim objColl As Collection
URL = "http://sdrk3020v/mi_toolbox/default.asp?query_name=spBUS_GCR_AllSchemes&app_id=2&FileType=csv&btnRunQuery=Run+query"
Set ieApp = CreateObject("InternetExplorer.Application")
ieApp.Visible = True
ieApp.navigate URL
While ieApp.Busy
'wait...
Wend
Set ieDoc = ieApp.Document
For Each ele In ieApp.Document.getelementsbytagname("a")
If ele.innertext = "query_1" Then
DoEvents
ele.Click
End If
Next
ieApp.Quit
End Sub
你的代碼工作正常。我剛剛更新了網址,並改變了'InnerText'。 –