This is Driving Me Nuts
New Member
- Joined
- Nov 22, 2019
- Messages
- 5
- Office Version
- 2016
- Platform
- Windows
G'day,
I am trying to quickly locate and see an internet explorer window which has already been opened . But I can not seem to make my vba code to open the existing web page. Any assistance on this challenge would be appreciated. Thank you
Sub Test()
Dim shell_application As Object
Dim open_window As Object
Dim ie As Object
Set shell_application = CreateObject("shell.application")
For Each open_window In shell_application.Windows
If TypeName(open_window.document) = "HTMLDocument" Then
Set ie = open_window
Exit For
End If
Next
If ie Is Nothing Then
MsgBox "did not find internet window"
Else
MsgBox "found the page, now navigating"
ie.navigate "google"
With ie
.Height = 600
.Width = 1900
.Top = 373
.Left = 25
.Visible = True
.Toolbar = False
.StatusBar = True
.MenuBar = False
End With
End If
Set ie = Nothing
End Sub
I am trying to quickly locate and see an internet explorer window which has already been opened . But I can not seem to make my vba code to open the existing web page. Any assistance on this challenge would be appreciated. Thank you
Sub Test()
Dim shell_application As Object
Dim open_window As Object
Dim ie As Object
Set shell_application = CreateObject("shell.application")
For Each open_window In shell_application.Windows
If TypeName(open_window.document) = "HTMLDocument" Then
Set ie = open_window
Exit For
End If
Next
If ie Is Nothing Then
MsgBox "did not find internet window"
Else
MsgBox "found the page, now navigating"
ie.navigate "google"
With ie
.Height = 600
.Width = 1900
.Top = 373
.Left = 25
.Visible = True
.Toolbar = False
.StatusBar = True
.MenuBar = False
End With
End If
Set ie = Nothing
End Sub