For my sins I have taken on a little data-mining project. I did this successfully for Clients back in the day, and have since deleted the folder Greaves\Clients, but have found some personal code that uses VBA to fire up ie.exe and I can save a web page in an Excel 2003 worksheet in text form. Good enough for me. In VBA I can send the data to Word2003 and make use of my library of Word2003/VBA string utilities to grab data for my buddy.
But ... nowadays ie.exe pops up doo-dads that suggest I migrate to Edge, opens up new tabs and pop-up boxes etc.
Question: Does Chrome, Edge, or any modern browser apart from ie have a VBA interface that would let me pass a URL as a parameter and store the resultant web page on my hard drive (for later analysis?)
I am not looking for specific VBA code at this stage, just a top-level decision as to whether I should continue with ie or bite the bullet and use a different browser.
My browser-of-choice is FireFox, and while I haven't looked, I have not heard of a VBA interface for FireFox.
For the record, here is a simple VBA to fire up ie.exe and load a web page:-
Code: Select all
Function OpenIEDocument(ie As Object, strURL As String, lngLimitWait As Long)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''' Function: OpenIEDocument
'''
''' Comments: Given a URL, attempt to locate it on the internet using ie.
'''
''' Arguments: VARIANT Instance of Internet Explorer
''' STRING URL of a wanted page
''' LONG Limit of "doevents" waits until we should conceded failure
'''
''' Returns: NONE
'''
''' Comments:
'''
''' Date Developer Action
''' --------------------------------------------------------------------------
''' 2010/02/27 Chris Greaves Created
'''
Dim lngCount ' tally of loops made waiting for the page
With ie
.Visible = True
On Error GoTo Failed
.Navigate strURL
On Error GoTo 0
Do Until .ReadyState = 4
lngCount = lngCount + 1 ' 5116:
If lngCount > lngLimitWait Then ' 5116:
Exit Do ' 5116:
Else ' 5116:
DoEvents
End If ' 5116:
Loop
End With
Exit Function
Failed:
Dim lngError As Long
lngError = Err.Number
Dim strDescription As String
strDescription = Err.Description
Select Case lngError
Case Else
' Stop
Resume Next
End Select
'Sub TESTOpenIEDocument()
' Dim ie As Object
' Set ie = CreateObject("InternetExplorer.Application")
' Call OpenIEDocument(ie, "https://chrisgreaves.com", 1000)
'End Sub
End Function
https://eileenslounge.com/search.php?st ... t+explorer
https://eileenslounge.com/viewtopic.php ... 2A#p272990
https://eileenslounge.com/viewtopic.php ... 2A#p231289
https://eileenslounge.com/viewtopic.php ... A&start=40
https://eileenslounge.com/viewtopic.php ... %2A#p99520
https://eileenslounge.com/viewtopic.php ... %2A#p65368
Thanks
Chris