2014-09-19 2 views
1

getElementById에 문제가있어 제대로 작동하지 않습니다. 내가 실행할 때 조건이 거짓이 될 때까지 기다리지 않습니다. 이 내 VBA 코드입니다 :VBA IE getElementById가 작동하지 않습니다.

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> 

또는 스타일 태그를 정의 할 수있는 방법이있다?

답변

0

페이지가로드되기를 기다리는 경우에는 바쁜 방법을 사용하십시오. 다음은 그 예입니다 :

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 

그게 도움이 되나요?

+1

내 페이지가 부분적으로로드되기 때문에 바쁜 메소드를 사용할 때 메소드가 작동하지 않고'wb.Readystate' 메소드도이 시나리오에서 작동하지 않기 때문에 작동하지 않습니다. – Sunil

관련 문제