0
WebQueryを動作させようとしていますが、それはできないようです。 私の目標は、Webページのソースコードをスクラップすることです。残念なことに、このサイトには、私のコードが正しく動作しない理由が異なるフレームがあるようです。したがって、フレーム問題を解決するはずのオンラインで見つかったコードを修正しようとしました。問題は、コードがうまくいかないことです。おそらく少し古いようです。誰でも助けてくれますか?VBA - Web Query - multiple Frames
次のコードは、作成時にエラー(objecetが必要): "設定profileFrame .document.getElementById(" profileFrame ")"
ます。Public Sub IE_Automation()
'Needs references to Microsoft Internet Controls and Microsoft HTML Object Library
Dim baseURL As String
Dim IE As InternetExplorer
Dim HTMLdoc As HTMLDocument
Dim profileFrame As HTMLIFrame
Dim slotsDiv As HTMLDivElement
'example URL with multiple frames
baseURL = "https://www.xing.com/search/members?section=members&keywords=IT&filters%5Bcontact_level%5D=non_contact"
Set IE = New InternetExplorer
With IE
.Visible = True
'Navigate to the main page
.navigate baseURL & "/publictrophy/index.htm?onlinename=ace_anubis"
While .Busy Or .readyState <> READYSTATE_COMPLETE: DoEvents: Wend
'Get the profileFrame iframe and navigate to it
Set profileFrame = .document.getElementById("profileFrame")
.navigate baseURL & profileFrame.src
While .Busy Or .readyState <> READYSTATE_COMPLETE: DoEvents: Wend
Set HTMLdoc = .document
End With
'Display all the text in the profileFrame iframe
MsgBox HTMLdoc.body.innerText
'Display just the text in the slots_container div
Set slotsDiv = HTMLdoc.getElementById("slots_container")
MsgBox slotsDiv.innerText
End Sub
幸運を祈り、 アンドレアス
こんにちはryguy72とありがとう!残念ながら私はエラー "私たちの範囲"を取得します。私は問題を回避するためにコンテンツをスクラップしてVBA経由でExcelにインポートするために、今はimacros chromeプラグインを使用しています。しかしもちろん、直接的な方法は、適切なやりかたでより便利です。最高の願いAndreas – Andreas
F8を繰り返し押してコードをステップ実行すると、 "our of range"というエラーがどこで発生しますか?どの行がエラーをスローしますか?それは手がかりになるはずです。しかし、私はどこにエラーがあると推測することはできませんか?私は何も疑いがなく、すべてがうまくいった。 – ryguy72