I am a novice to VBA and am attempting to extract information from multiple websites. I will be forever grateful for any help. I have searched but haven't found anything quite like what I am attempting. I need to navigate to one webpage (strURL5 in my code) and then to strURL6 in one instance of IE. Or navigate to strURL5 and then select a specific link from that webpage. I know this is probably trivial, but I am going insane trying to figure this out.
Here is the code I currently have:
Sub GetAllOrgData()
Dim HTMLdoc As HTMLDocument
Dim ie As Object
Dim doc As Object
Dim doc2 As Object
Dim doc3 As Object
Dim doc4 As Object
Dim doc5 As Object
Dim doc6 As Object
Dim strURL As String
Dim strURL2 As String
Dim strURL3 As String
Dim strURL4 As String
Dim strURL5 As String
Dim strURL6 As String
strURL = "https://blahblahblah" & Range("OrgID").Value & "&RegistrationLocationId="
strURL2 = "https://blahblahblah" & Range("OrgID").Value
strURL3 = "blahblahblah" & Range("OrgID").Value & "/integrationevents?from=" & Range("FOM").Value & "&to=" & Range("EOM").Value & "blahblahblah"
strURL4 = "blahblahblah" & Range("OrgID").Value
strURL5 = "https://THIS IS THE WEBPAGE I NEED TO LOAD FIRST" & Range("OrgID").Value & "/reports"
strURL6 = "https://THIS IS THE WEBSITE I NEED TO GET INFORMATION FROM"
Set ie = New InternetExplorerMedium
With ie
Visible = True
ie.navigate strURL
Do Until .readyState = 4: DoEvents: Loop
Do While .Busy: DoEvents: Loop
Set doc = ie.document
GetAllTables doc
ie.navigate strURL2
Do Until .readyState = 4: DoEvents: Loop
Do While .Busy: DoEvents: Loop
Set doc2 = ie.document
GetAllTables2 doc2
ie.navigate strURL3
Do Until .readyState = 4: DoEvents: Loop
Do While .Busy: DoEvents: Loop
Set doc3 = ie.document
GetAllTables3 doc3
ie.navigate strURL4
Do Until .readyState = 4: DoEvents: Loop
Do While .Busy: DoEvents: Loop
Set doc4 = ie.document
GetAllTables4 doc4
ie.navigate strURL5
Do Until .readyState = 4: DoEvents: Loop
Do While .Busy: DoEvents: Loop
ie.navigate strURL6
Do Until .readyState = 4: DoEvents: Loop
Do While .Busy: DoEvents: Loop
Set doc5 = ie.document
GetAllTables5 doc5
End With
End Sub
Bookmarks