2016-09-01 9 views
0

他の誰かが同じ質問をしているのを見ましたが、回答がうまくいきませんでした。 Windows 10 Internet Explorer 11,64ビットを実行しています 私は..私は薄暗い新InternetExplorerMediumなどの新しいのInternetExplorerや点心IEとしてIEが、それでも同じエラーしようとしている vbaエラーメッセージ13 IEドキュメント

最後の行

でエラーの不一致エラー13を取得

私はエラーをしてください取り除くことができます任意のアイデア? おかげ

Sub test() 

Dim IE As Object ' InternetExplorer 
Set IE = CreateObject("internetexplorer.application") 

Dim html As HTMLDocument 
Set IE = New InternetExplorer 

IE.Visible = True 

IE.navigate "http://stackoverflow.com/" 

'wait while web page load 

Set html = IE.document 

end sub 
+0

VBAにはどのような参照情報が追加されていますか? –

+0

はいMicrosoft HTMLオブジェクトライブラリとMicrosoftインターネットコントロールを追加しました – Matrix1977

+0

32ビットオフィス、または64ビットを使用していますか? –

答えて

1

HTMLDocumentのために代わりに遅延バインディングを使用してみてください。通常、ドキュメントをオブジェクトに割り当てる必要はありません。別のものに割り当てることなく、ドキュメントと対話できます。

Sub test() 
    Dim IE As New InternetExplorer ' Make sure you have Microsoft Internet Controls Reference added 
    Dim html As Object ' Or you can use HtmlDocument as the type if Microsoft HTML Object Reference is added 

    With IE 
     .Visible = True 
     .navigate "http://stackoverflow.com/" 
     While .busy Or .readystate <> 4 
      Application.Wait (Now() + TimeValue("00:00:01")) 
      DoEvents 
     Wend 
     Set html = .document 
    End With 
End Sub 
関連する問題