HTML coding in Excel VBA

  • Thread starter Thread starter Sheela
  • Start date Start date
S

Sheela

Hello,

Can anybody tell me if this coding works with Excel 2002?

Open OutputFile For Output As #1

LineInput = "<html><head><title>" & HeaderData
& "</title></head><body>"
HtmlWrite (LineInput)
LineInput = "<basefont size=3><table cellpadding=0
cellspacing=0 width=100%><tr><td valign=top align=left>"
HtmlWrite (LineInput)
LineInput = "<a href=""../mopscrud.htm""><strong>Crude
Platts</strong></a> ... "
HtmlWrite (LineInput)
LineInput = "<a href=""../termcrud.htm""><strong>Tapis
PTP</strong></a> ... "
HtmlWrite (LineInput)
LineInput = "<a href=""ptp.htm""><strong>Term
Prices</strong></a> ... "
HtmlWrite (LineInput)
LineInput = "<a href=""../diff-tpc.htm""><strong>Tapis
Trends</strong></a>"
HtmlWrite (LineInput)

LineInput = "</td></tr></table><hr>"
HtmlWrite (LineInput)


Thanks,
Sheela
 
I put your code into a module in Excel 2002 and my VBA editor didn't
recognize anything past the first line. 'LineInput' was not found in my
Object Browser search.

Bruce Cooley



: Hello,
:
: Can anybody tell me if this coding works with Excel 2002?
:
: Open OutputFile For Output As #1
:
: LineInput = "<html><head><title>" & HeaderData
: & "</title></head><body>"
: HtmlWrite (LineInput)
: LineInput = "<basefont size=3><table cellpadding=0
: cellspacing=0 width=100%><tr><td valign=top align=left>"
: HtmlWrite (LineInput)
: LineInput = "<a href=""../mopscrud.htm""><strong>Crude
: Platts</strong></a> ... "
: HtmlWrite (LineInput)
: LineInput = "<a href=""../termcrud.htm""><strong>Tapis
: PTP</strong></a> ... "
: HtmlWrite (LineInput)
: LineInput = "<a href=""ptp.htm""><strong>Term
: Prices</strong></a> ... "
: HtmlWrite (LineInput)
: LineInput = "<a href=""../diff-tpc.htm""><strong>Tapis
: Trends</strong></a>"
: HtmlWrite (LineInput)
:
: LineInput = "</td></tr></table><hr>"
: HtmlWrite (LineInput)
:
:
: Thanks,
: Sheela
:
 
She was using LineInput as the name of a variable. VBA does have a Line Input command (2 words),
so IMO LineInput isn't a good choice for a variable name -- too confusing.
 
There must be a function/sub created by the author of the code titled
htmlwrite. Otherwise your code is non-functional. There is no built in VBA
command htmlwrite. I provided a reference on how to write out a text file.
If you can't find the orginal author's htmlwrite function/sub, then you can
write you own using the reference.

--
Regards,
Tom Ogilvy

Sheela said:
Is there another way of writing this code? There are so
many lines created which starts with "LineInput = ..."
and followed by "HtmlWrite (LineInput)". I believe the
first one is to input the lines and the second if to
display the message. If this is not working, what is the
other way to write this html coding in VBA?

Below is the sample coding for you to have a better
picture on the coding flow.

------------------------------
Open OutputFile For Output As #1

LineInput = "<html><head><title>" & HeaderData
& "</title></head><body>"
HtmlWrite (LineInput)
LineInput = "<basefont size=3><table cellpadding=0
cellspacing=0 width=100%><tr><td valign=top align=left>"
HtmlWrite (LineInput)
LineInput = "<a href=""../mopscrud.htm""><strong>Crude
Platts</strong></a> ... "
HtmlWrite (LineInput)
LineInput = "<a href=""../termcrud.htm""><strong>Tapis
PTP</strong></a> ... "
HtmlWrite (LineInput)
LineInput = "<a href=""ptp.htm""><strong>Term
Prices</strong></a> ... "
HtmlWrite (LineInput)
LineInput = "<a href=""../diff-tpc.htm""><strong>Tapis
Trends</strong></a>"
HtmlWrite (LineInput)

LineInput = "</td></tr></table><hr>"
HtmlWrite (LineInput)

If HeaderData <> "" Then
LineInput = "<font size=+2 color=red>" & HeaderData
& "</font>"
HtmlWrite (LineInput)
End If
If DescriptionText <> "" Then
LineInput = "<I>" & DescriptionText & "</I>"
HtmlWrite (LineInput)
End If

LineInput = "<br><p>"
HtmlWrite (LineInput)
LineInput = "<table border><caption><b>" & TableCaption
& "</b></caption>"
HtmlWrite (LineInput)
------------------------

Thanks,
Sheela
-----Original Message-----
She was using LineInput as the name of a variable. VBA
does have a Line Input command (2 words),
 
Back
Top