M
Mike NG
Hi
I am reposting this as I still had some code missing and the point about
the reference
Pasting this in will now compile
Calling GotoURL first time round works fine
Try minimising your browser window
Call GotoURL a second time
It does not re-maximise itself. I'm sure it did when I wrote this under
XL97. Now on XL2000 it doesn't work
Insert Module
paste the following code in
set a reference to Microsoft Internet Controls
Option Explicit
Public Declare Function ShowWindow Lib "user32" (ByVal hWnd As _
Long, ByVal nCmdShow As Long) As Long
Public Declare Function IsIconic Lib "user32" (ByVal hWnd As Long) _
As Long
Const SW_SHOW = 9
Const SW_RESTORE = 8
Const SW_MAXIMIZE = 3
Dim oIE As InternetExplorer
'**************************
'* Start IE and visit URL *
'**************************
Sub GotoURL(psURL As String)
Dim bPresent As Boolean
Dim sTypeName As String
'GetObject ("",InternetExplorer.Application) will latch on to
'Turnpike is less functional than full IE
'GetObject ("",InternetExplorer) won't latch on to IE at all
'(known feature), so implement our own kind of version which
'does the same sort of thing
sTypeName = TypeName(oIE)
If sTypeName = "Nothing" Or sTypeName = "Object" Then
'Nothing means never initialised
'Object means a previous IE instance has been shut down
Set oIE = New InternetExplorer
Else
'Instance already running
bPresent = True
End If
'All this seems to be necessary too, because it seems to be
'the only way to bring iconised windows back to life because
'there is no WindowState attribute
With oIE
If bPresent Then
If IsIconic(.hWnd) Then
ShowWindow .hWnd, SW_RESTORE
Else
ShowWindow .hWnd, SW_SHOW
ShowWindow .hWnd, SW_MAXIMIZE
End If
Else
ShowWindow .hWnd, SW_MAXIMIZE
End If
.Navigate psURL
End With
End Sub
I am reposting this as I still had some code missing and the point about
the reference
Pasting this in will now compile
Calling GotoURL first time round works fine
Try minimising your browser window
Call GotoURL a second time
It does not re-maximise itself. I'm sure it did when I wrote this under
XL97. Now on XL2000 it doesn't work
Insert Module
paste the following code in
set a reference to Microsoft Internet Controls
Option Explicit
Public Declare Function ShowWindow Lib "user32" (ByVal hWnd As _
Long, ByVal nCmdShow As Long) As Long
Public Declare Function IsIconic Lib "user32" (ByVal hWnd As Long) _
As Long
Const SW_SHOW = 9
Const SW_RESTORE = 8
Const SW_MAXIMIZE = 3
Dim oIE As InternetExplorer
'**************************
'* Start IE and visit URL *
'**************************
Sub GotoURL(psURL As String)
Dim bPresent As Boolean
Dim sTypeName As String
'GetObject ("",InternetExplorer.Application) will latch on to
'Turnpike is less functional than full IE
'GetObject ("",InternetExplorer) won't latch on to IE at all
'(known feature), so implement our own kind of version which
'does the same sort of thing
sTypeName = TypeName(oIE)
If sTypeName = "Nothing" Or sTypeName = "Object" Then
'Nothing means never initialised
'Object means a previous IE instance has been shut down
Set oIE = New InternetExplorer
Else
'Instance already running
bPresent = True
End If
'All this seems to be necessary too, because it seems to be
'the only way to bring iconised windows back to life because
'there is no WindowState attribute
With oIE
If bPresent Then
If IsIconic(.hWnd) Then
ShowWindow .hWnd, SW_RESTORE
Else
ShowWindow .hWnd, SW_SHOW
ShowWindow .hWnd, SW_MAXIMIZE
End If
Else
ShowWindow .hWnd, SW_MAXIMIZE
End If
.Navigate psURL
End With
End Sub