Private Sub WebBrowser1_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean) If pDisp.Document Is Nothing Then Exit Sub End If ' この画像判定メソッドは、自力で実装する必要があります。 If Not IsPicture(URL, Flags, TargetFrameName, PostData, Headers) Then Exit Sub End If ' A タグの場合、target="_blank" の属性を指定する。 Dim element As Object Set element = pDisp.Document.activeElement If element.tagName = "A" And element.Target <> "_blank" Then element.Target = "_blank" WebBrowser1.PutProperty "targetAnchor", Array(element) '一度キャンセルしてから、タイマー経由で呼びなおす。 Cancel = True Timer1.Interval = 55 Timer1.Enabled = True End If End Sub Private Sub Timer1_Timer() Timer1.Enabled = False Dim v As Variant v = WebBrowser1.GetProperty("targetAnchor") WebBrowser1.PutProperty "target", Empty If IsArray(v) Then ' A タグをクリックする。 v(0).Click Erase v End If End Sub Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean) ' 新たな別ウィンドウとして、Form2 上の WebBrowser を指定 Dim f As Form2 Set f = New Form2 f.WebBrowser1.RegisterAsBrowser = True Set ppDisp = f.WebBrowser1.Object f.Show End Sub