Question

Locked

How to capture values in HTML Table into an Excel file using a VB Script

By Pogster ·
To begin, im starting to feel the limitations of VBS and am doubting whether this is possible, but maybe someone better-versed in VB than I can answer the question. I have a simple VB Script that logs into a website i access daily and i need it to pull values from a table on this website. I can provide some of the code on request, but the only piece im having issues with really is the pulling of the table data into excel (and format it!).

Right now i am using a very simple action to copy the entire html text into a txt file, but that is not the output i am looking for.

PageCache = objIE.document.body.innerHTML
Set objFileSystem = CreateObject("Scripting.fileSystemObject")
Set objOutputFile = objFileSystem.CreateTextFile("C:\MyFolder\Output.txt", TRUE)
objOutputFile.WriteLine(PageCache)
objOutputFile.Close

I want to use this functionality in conjunction with this:

Set objExcel = CreateObject("Excel.Application")
'Copy the text values in the table here and format the table in excel (this is the code im looking for)

'Save the file and quit
Set objWorkbook = objExcel.Workbooks.Add()
objWorkbook.SaveAs("Test Output")
objExcel.Workbooks.Close
objExcel.quit


So the question is, is there a way in which this could be done, and how could i do it. I would rather just stick with VB (im a beginner) but if i must use some other options, im open to them.

Thank you all in advance! This one is stumping me!

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
Thread display: Collapse - | Expand +

All Answers

Collapse -

You should be able to do it with DOM

by Slayer_ In reply to How to capture values in ...

Since HTML is just a form of XML, you should be able to do what you want if you use DOM.

Google up DOM in VBS.

Collapse -

DOM in VBS

by Pogster In reply to You should be able to do ...

Cool, i found an MSDN article detailing DOM in VBS, ill be sure to try it out. Would you happen to have any sample code using DOM?

I will go do my research! Thanks!

Collapse -

Sample code using DOM here....

by Peconet Tietokoneet In reply to DOM in VBS
Back to Web Development Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums