Sub ie_test() 'IEテストする。
'IEの起動
Dim objIE As Object '変数を定義します。
Set objIE = CreateObject("InternetExplorer.Application") 'オブジェクトを作成します。
objIE.Visible = True '可視、Trueで見えるようにします。
'処理したいページを表示します。
objIE.Navigate "http://www.google.co.jp/"
'ページの表示完了を待ちます。
While objIE.ReadyState <> 4 Or objIE.Busy = True '.ReadyState <> 4の間まわる。
DoEvents '重いので嫌いな人居るけど。
Wend
'google検索項目(name=q)にセットする。
objIE.Document.getElementsByName("q")(0).Value = "三流"
End Sub
'
Private Sub OpenWebPage22(ByVal url As String)
Dim objIE
Dim objShell As Object
Dim n As Integer
Dim low As String
Dim col As String
Dim i As Long
' low = ActiveCell.Row
' col = ActiveCell.Range
'
Set objShell = CreateObject("Shell.Application")
'後ろから消してく。.Windowsでエクスプローラーとインターネットエクスプローラーにさわれる
For n = objShell.Windows.Count To 1 Step -1 'MAXから-1ひいてく感じ
Set objIE = objShell.Windows(n - 1) 'n番目のウインドウを代入
'.FullNameで普通のファイルエクスプローラーとIE(インターネットエクスプローラー)を区別する
If Right(UCase(objIE.FullName), 12) = "IEXPLORE.EXE" Then
If Right(objIE.document.url, 24) = url Then '次に.URLでURLのチェック
Debug.Print objIE.document.url '.QUITで該当URLを閉じる
Exit For
End If
End If
Next
Set objShell = Nothing
For i = 0 To 26
If Cells(2, i + 2) <> "" Then
If Cells(1, i + 2) <> "" Then
objIE.document.getElementById(Cells(1, i + 2)).Value = Cells(3, i + 2)
If Cells(2, i + 2) = "Assembly Parts Flag" _
And Cells(3, i + 2) = "1" Then
objIE.document.getElementById(Cells(1, i + 2)).Value = True
End If
End If
End If
Next
' Call objIE.document.getElementById("regImg").Click
End Sub