the function goes as follows: it is scraping some page HTML to get a value within TAGS.
so it is searching from an URL a specific tag name and it takes the value.
but when I execute my form, it says that: "Can't move focus to the control because it is invisible, not enabled, or of type that does not accept focus" I dont udnerstand.
the function is here ->
Private Function parsingHTML() As String
Dim doc1 As New mshtml.HTMLDocument, doc2 As mshtml.HTMLDocument
Dim ips As IPersistStreamInit
Dim myElements As mshtml.IHTMLElementCollect
ion
Dim myElement As mshtml.IHTMLElement
Dim script As mshtml.HTMLScriptElement
Dim strValue As String
Try
ips = DirectCast(doc1, IPersistStreamInit)
ips.InitNew()
doc2 = doc1.createDocumentFromUrl
(getUrl, vbNullString)
Do Until doc2.readyState = "complete"
Application.DoEvents()
myElements = doc2.getElementsByTagName(
"INPUT")
For Each myElement In myElements
If myElement.getAttribute("NA
ME") = "p_iden_tran" Then
strValue = myElement.getAttribute("VA
LUE")
Exit Do
End If
Next
Loop
Catch e As WebException
Debug.Write(e.ToString)
End Try
Return strValue
End Function
<-
Start Free Trial