Private Declare Function SetForegroundWindow Lib "user32" _
(ByVal hWnd As Long) As Long
Private Declare Function IsIconic Lib "user32" _
(ByVal hWnd As Long) As Long
Private Declare Function ShowWindowAsync Lib "user32" _
(ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Sub web1()
Dim myobj As Object, objIE As Object
Dim fff As String, mycnt
Set myobj = CreateObject("Shell.Application")
mycnt = myobj.Windows.Count
fff = "http://www2s.biglobe.ne.jp/~iryo/"
'fff = """https://www.google.co.jp/?gws_rd=ssl""" 'VBAの記述時、?付きは""3個にする
With myobj.Windows
Shell ("EXPLORER.EXE " & fff)
Do
DoEvents
Loop Until mycnt + 1 <= .Count
Set objIE = .Item(mycnt)
End With
Do While objIE.ReadyState <> 4 Or objIE.Busy = True
DoEvents
Loop
If IsIconic(objIE.hWnd) Then
ShowWindowAsync objIE.hWnd, &H9
End If
SetForegroundWindow (objIE.hWnd)
Set objIE = Nothing
Set myobj = Nothing
End Sub
|