SuperKoopa
Technical User
Hello there,
I am trying to pull specific lines of data from the body text of a secured website. I've done some tinkering and have just one issue that hopefully there are many ways to resolve and perhaps someone can help me.
So, the snippet of source code looks like this:
<TD vAlign=top width="50%" ><FONT size=+0><I><B>NAME</B></I><BR><B>John Smith</B> <BR>123 N. 13th Ave <BR>Queensboro, NY<BR><BR></FONT></TD>
<TD vAlign=top width="50%" ><FONT size=+0><I><B>NAME 2</B></I><BR><B>Jane Smith</B> <BR>123 N. 13th Ave <BR>Queensboro, NY<BR><BR></FONT></TD>
For someone reason the host of this site didnt feel it was necessary to make the "Name" a class so I'm having to try and write something that identifies the word NAME (and if it exists NAME 2). Then, it needs to get the actual name (which could be 20 characters or 60 characters. I don't want it to copy the actual "NAME" or "NAME 2" text, just the actual names...which of course will vary.
SO, what I've some up with so far will pull just the word "NAME", but since the number of characters in the name will vary I haven't been able to account of that without putting a fixed number to it. That is unless I use the Len("<BREAK<") and of course that only gives me until the 1st BREAK, i need it to START after the 1st break after the word name, and end at the 2nd break. If anyone can help me with this or think of an alternative I would greatly appreciate it.
Here is what I currently have (I haven't done the IF/THEN for "NAME 2" yet):
Dim CaseInf As String
Dim CResults As String
Dim dtTimer As Date
Dim lAddTime As Long
Dim FName As Integer
Const lREADYSTATE_COMPLETE As Long = 4
dtTimer = Now
lAddTime = TimeValue("00:00:20")
Do Until appIE.readystate = lREADYSTATE_COMPLETE And Not appIE.busy
DoEvents
If dtTimer + lAddTime > Now Then Exit Do
Loop
CaseInf = appIE.document.Body.innertext
FName = InStr(1, CaseInf, "NAME")
CResults = Mid(CaseInf, FName, Len("<BREAK>"))
Sheets("Sheet1").Range("A1") = CResults
I am trying to pull specific lines of data from the body text of a secured website. I've done some tinkering and have just one issue that hopefully there are many ways to resolve and perhaps someone can help me.
So, the snippet of source code looks like this:
<TD vAlign=top width="50%" ><FONT size=+0><I><B>NAME</B></I><BR><B>John Smith</B> <BR>123 N. 13th Ave <BR>Queensboro, NY<BR><BR></FONT></TD>
<TD vAlign=top width="50%" ><FONT size=+0><I><B>NAME 2</B></I><BR><B>Jane Smith</B> <BR>123 N. 13th Ave <BR>Queensboro, NY<BR><BR></FONT></TD>
For someone reason the host of this site didnt feel it was necessary to make the "Name" a class so I'm having to try and write something that identifies the word NAME (and if it exists NAME 2). Then, it needs to get the actual name (which could be 20 characters or 60 characters. I don't want it to copy the actual "NAME" or "NAME 2" text, just the actual names...which of course will vary.
SO, what I've some up with so far will pull just the word "NAME", but since the number of characters in the name will vary I haven't been able to account of that without putting a fixed number to it. That is unless I use the Len("<BREAK<") and of course that only gives me until the 1st BREAK, i need it to START after the 1st break after the word name, and end at the 2nd break. If anyone can help me with this or think of an alternative I would greatly appreciate it.
Here is what I currently have (I haven't done the IF/THEN for "NAME 2" yet):
Dim CaseInf As String
Dim CResults As String
Dim dtTimer As Date
Dim lAddTime As Long
Dim FName As Integer
Const lREADYSTATE_COMPLETE As Long = 4
dtTimer = Now
lAddTime = TimeValue("00:00:20")
Do Until appIE.readystate = lREADYSTATE_COMPLETE And Not appIE.busy
DoEvents
If dtTimer + lAddTime > Now Then Exit Do
Loop
CaseInf = appIE.document.Body.innertext
FName = InStr(1, CaseInf, "NAME")
CResults = Mid(CaseInf, FName, Len("<BREAK>"))
Sheets("Sheet1").Range("A1") = CResults