Hi All,
I decided to drop a question here since I could not find a solution after looking for hours.
I am working on a DB which gets information from a web page. The script starts with trying to use an open instance of internet explorer.
This part doesn't work. I have used the script successful in excel, but run into an error when running It with Access:
"ActiveX component can't create object" (Error 429)
The part of code is as following:
Code:
Sub TestY()
Dim GetIEatURL As Object
Dim sMatch As String
Dim ie As Object
Dim oShApp As Object
Dim oWin As Object
sMatch = "https://www.google.com"
On Error Resume Next
Set oShApp = CreateObject("Shell.Application")
For Each oWin In oShApp.Windows
If TypeName(oWin.Document) = "HTMLDocument" Then
Set ie = oWin
If LCase(ie.LocationURL) Like LCase(sMatch) Then
Exit For
End If
End If
Next
Set oShApp = Nothing
Set oWin = Nothing
Debug.Print ie.LocationURL
End Sub
The error happens with the line
Code:
Set oShApp = CreateObject("Shell.Application")
The References I use are:
Visual Basic For Applications
Microsoft Access 15.0 Object Library
Microsoft Excel 15.0 Object Library
OLE automation
Microsoft Ofice 15.0 Object Library
Microsoft Internet controls
Microsoft Shell Controls and automation
Microsoft HTML object library
ExcelPlugInSHell 1.0 Type library
Any help will be appreciated!