簡體   English   中英

VBA IE getElementById無法正常工作

[英]VBA IE getElementById not working

我在使用getElementById時遇到問題,它無法正常工作。 當我執行它時,不要等到條件為假。 這是我的VBA代碼:

If IE.Document.getElementById("ReportViewerControl_AsyncWait_Wait").Style.visibility = "visible" Then
   Application.Wait (Now + TimeValue("0:00:02"))
End If

HTML代碼

<DIV id=ReportViewerControl_AsyncWait style="CLIP: rect(0px 1914px 142px 0px); HEIGHT: 144px; WIDTH: 1916px; POSITION: absolute; LEFT: 0px; FILTER: alpha(opacity=70); Z-INDEX: 1000; DISPLAY: none; TOP: 246px; VISIBILITY: visible; BACKGROUND-COLOR: white; opacity: 0.7" control="[object Object]" _oldDisplayMode="block"></DIV>

還是有什么方法可以定義樣式標簽?

如果您正在等待頁面加載,請使用busy方法。 這是一個例子:

Dim wb As Object
Dim doc As Object

Set wb = CreateObject("InternetExplorer.Application")

'Address of site
wb.navigate "http://stackoverflow.com/" 
wb.Visible = True

'Waits for page to load
While wb.busy
    DoEvents
Wend

有幫助嗎?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM