I want my code to perform this set of steps:
- get the URL from a cell
- open the URL
- wait some seconds to let the page load
- click a button on the page to create a DB object
- wait some second to let the page load
- close the page
- update the status bar to show progress
Opening and closing IE at every instance of the loop is needed to avoid clogging IE with too many tabs. In the sheet there might by up to 1000 URL's.
This is the loop I have written
For i = 14 To 13 + Count
'get the URL
URL = Range("F" & i)
'Open IE instance
Set IE = CreateObject("InternetExplorer.Application")
'navigate to the URL
With IE
.Visible = True
.Navigate URL
End With
'wait that the page is loaded
Application.Wait (Now() + TimeValue("0:00:4"))
'click on the create object button
Set Tags = IE.Document.GetElementsByTagname("Input")
For Each tagx In Tags
If tagx.alt = "Create object" Then
tagx.Click
End If
Next
'wait the page to be loaded
Application.Wait (Now() + TimeValue("0:00:10"))
'close the tab
IE.Quit
'update progess bar
Application.StatusBar = "Progress: " & i - 13 & " of " & Count & ": " & Format((i - 13) / Count, "0%")
Next i
when I check the code step by step I get this error
on the set Tags
line, and I have no clue how to fix it.
I have tried recording a macro to see how VBA sees the action of clicking the button, but that action is not recorded at all.