vba reference...

O

orbii

is it possible or a reference to allow me to extract data from a html
file... example, i needed my vba code to return me all href and src attribs
values from a few selected tags. do i have to clearly write a code from
scratch? someone in my office said to look up on DOM, something on object
model or something, but non of us here know enough about vba to make a clue
in the vast sea of tech abbriviation.

could someone point me in a direction? anything that helps would be greatly
appriciated.

ps: could anyone past a small code that would allow me to open a simple text
file and pull in data to excel line by line? the help file on excel vba
arn't too helpful like php...

aloha, orbii
 
M

Martin Fishlock

The DOM (Document Object Model) is a W3C project (see http://www.w3.org/DOM/
) and AFAIK won't help you here.

The general process for the reading files is:

Sub processfile()
Dim s As String
Dim lRow As Long
Open "filename.html" For Input As #1
Do While Not EOF(1)
lRow = lRow + 1
Line Input #1, s
Cells(lRow, 1) = s
Loop
Close #1
End Sub
 
M

Martin Fishlock

Sorry I forgot to mention that this is quite a difficult process to parse an
HTML file as attributes don't have to be an the same line and can be split.

But it can be done.
 
O

orbii

hi martin, thank you so much for your info. i might just go the php route
by using excel to trigger php then spit the file back. but your info is
very much helpful.

btw, what is AFAIK? and how do i rate this reply?

aloha orbii
 
O

orbii

oh i forgot to mention, we found something in vba refernce that is named
"Microsoft HTML Object Libary" this morning.

aloha, orbii
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top