in vb5 how do I copy line 1006 from a web page into a text box using the internet explorer control
Printable View
in vb5 how do I copy line 1006 from a web page into a text box using the internet explorer control
line 1006 ? from source code? how are you getting source code? document.body.outerhtml?
or do you mean line 1006 of the Internet Explorer Menu (View - Source) Line 1006?
i dont know how to get 1006 line of IE Source because IE have its own Html "Source" Viewer but if you know what you are looking for its easier to get. if not you would have to get the text from IE Source Viewer's textbox will require API Calls
if you get code with inet its close but not exactly the same ...
1006 is just a random number
if i cant get it directly from the control how do i get the 1006th line of text7.text into text 1
InternetExploiter.Navigate "http://www.youtube.com/"
Dim sText As String, sTextHTML As String
Dim SleepS
sT = InternetExploiter.Document.body.innerText
sTextHTML = InternetExploiter.Document.documentElement.outerHTML
Text7.Text = sTextHTML
this is to extract certain lines of text from web pages i can convert pages for old browsers like cello
i want to take the info from sites and have a semi automatic conversion
i would have to update this each re desighn
please always post code inside code tags. it is much better more readableCode:
InternetExploiter.Navigate "http://www.youtube.com/"
Dim sText As String, sTextHTML As String
Dim SleepS
sT = InternetExploiter.Document.body.innerText
sTextHTML = InternetExploiter.Document.documentElement.outerHTML
Text7.Text = sTextHTML
what is so interesting about line 1006? what are you trying to get out of it?
you can use a function like this (when it is split with vbnewline)
Get line text like thisCode:Private Function ExtractLine(LineNumber As Integer, TextString) As String
On Error GoTo ErrHandler
Dim SPT() As String 'Split Text
'When you split your array will start with 0. but in our language 0 is not a line 1 would be the first line not 0.
'so i will substract 1 number from Line_Number to be the exact match
SPT = Split(TextString, vbNewLine)
MsgBox UBound(SPT)
ExtractLine = SPT(LineNumber - 1)
Exit Function
ErrHandler:
MsgBox "Invalid Line Number.", vbInformation, "Error while Extracting Text"
End Function
but in this case the string is all one line for some reason.. well when i use your code there is no vbNewLine splitCode:MsgBox ExtractLine(1,Text1.Text)
i'm not sure exactly what you want to do but you might have to get object by object from the document... or go by TAG / ID / ELEMENT name