Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

search html source code and return a string

Status
Not open for further replies.

LouieLouieOhOh

Technical User
Feb 12, 2008
2
0
0
US
I am a beginner/novice using VB in excel. I am able to open an instance of IE (internet explorer) and input data from a spreadsheet into the web page (add cell values into text boxes in a form).

What I need to do is extract a text string from the page source ... the string is "always" preceeded by the text

<row id= '

then the string follows ... as

12345.67891.21212.65656

so, 5 digits, a period, etc. for a total of 23 charactors.

Can someone show me how to "grab" this string of data? example of the code is attached (can't give exact html document, sorry ... boss won't allow it).
 
Hi,

Here is some useful excel script:
I had column 1 (strIPvalue) as the ip address and column 2 (strtest) as another data field. The script loops through so with the variables created you can do what you like.


Do While Not IsEmpty(objExcel.Cells(loopCount, 1).Value)
strIPvalue = objExcel.Cells(intLoopCount,1).Value
strtest = objExcel.Cells(intLoopCount,2).Value

'Displays the IP Address in a message box
Wscript.Echo strIPvalue
Wscript.Echo strtest

I'd suggest Regular Expression to find the data you need, there pretty powerful.

Hope his helps..
 
take a look at instr, Left, Right, and Mid functions

Never knock on Death's door: ring the bell and run away! Death really hates that!
 
A bit more advanced but far more powerful are Regular Expresions' and example can be found in thread329-1450029

Never knock on Death's door: ring the bell and run away! Death really hates that!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top