Guest User

Untitled

a guest
Aug 14th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #If VBA7 Then
  2. Private Declare PtrSafe Function GetInputState Lib "user32" () As LongPtr
  3. #Else
  4. Private Declare Function GetInputState Lib "user32" () As Long
  5. #End If
  6.  
  7. #If VBA7 Then
  8. Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal ms As LongPtr)
  9. #Else
  10. Private Declare Sub Sleep Lib "kernel32" (ByVal ms As Long)
  11. #End If
  12.  
  13. Private Function F_GetHTMLDoc2(ByVal URL As String) As HTMLDocument
  14. Dim HTML As MSHTML.HTMLDocument
  15. Set HTML = New MSHTML.HTMLDocument
  16.  
  17. Dim myDocument As MSHTML.HTMLDocument
  18. Set myDocument = HTML.createDocumentFromUrl(URL, vbNullString)
  19.  
  20. Do While HTML.ReadyState <> "complete"
  21. If GetInputState() = True Then DoEvents
  22. Sleep 1
  23. Loop
  24.  
  25. Set F_GetHTMLDoc2 = myDocument
  26.  
  27. Set HTML = Nothing
  28. Set myDocument = Nothing
  29. End Function
Add Comment
Please, Sign In to add comment