我正在尝试运行一个宏,该宏单击IE网页以下载文件。运行宏时,我遇到Runtime Error 91: Object variable or with block variable not set
出于安全目的删除了url字符串
突出显示的行是Element.Click
我该如何解决
Sub Playthissub()
Call Scrape("myurl") '' change the website here and execute this sub.
End Sub
Sub Scrape(url As String)
Dim Browser As InternetExplorer
Dim Document As HTMLDocument
Dim Elements As IHTMLElementCollection
Dim Element As HTMLGenericElement
Set Browser = New InternetExplorerMedium
Browser.Visible = True
Browser.Navigate url
Do While Browser.Busy And Not Browser.readyState = READYSTATE_COMPLETE
DoEvents
Loop
Set Document = Browser.Document
Set Elements = Document.getElementsByTagName("navPipeline")
Element.Click
Browser.Quit
End Sub