Link to home
Start Free TrialLog in
Avatar of intertise
intertise

asked on

vb6 email formatted as html creating lines

Here is the code for building the string to email. It creates white blank lines of two different sizes throughout the report. The actual email is behind a firewall, but i'd be happy to send someone a jpeg of it if they wish.

I notice it happens after the 4th roll through, and then then 8th.


stremailmessage = "<HTML><HEAD></HEAD><BODY><h2>Locations not working for " & Date & "<h2>" & "<BR>"
stremailmessage = stremailmessage & "<font face = ""Arial"" size = 1><table border=""1"" cellpadding=""0"" cellspacing=""0"" style=""border-collapse: collapse"" bordercolor=""#111111"" width=""100%"" id=""AutoNumber1"">"
stremailmessage = stremailmessage & "<tr><td width=""10%""><font size ""1"">Counter</font></td><td width=""20%""><font size ""1"">Location Name</font></td><td width=""20%""><font size ""1"">City</font></td>"
stremailmessage = stremailmessage & "<td width=""20%""><font size ""1"">Connection Type</font></td><td width=""20%""><font size ""1"">Machine Name</font></td><td width=""30%""><font size ""1"">Last Connected</font></td>"
stremailmessage = stremailmessage & "<td width=""20%""><font size ""1"">Connection Time</font></td><td width=""20%""><font size ""1"">Hours Since Last Connection</font></td></tr></font>"

stremailmessage = stremailmessage & "<td width=""10%"" bgcolor = """ & strHolder & """>" & Counter & "</td>"
            stremailmessage = stremailmessage & "<td width=""20%"" bgcolor = """ & strHolder & """>" & AdoRec("Location Identifier") & "<font size = ""1""></font>&nbsp;</td>"
            stremailmessage = stremailmessage & "<td width=""20%"" bgcolor = """ & strHolder & """>" & AdoRec("Location City") & "</td>"
            stremailmessage = stremailmessage & "<td width=""20%"" bgcolor = """ & strHolder & """>" & AdoRec("Connection Type") & "</td>"
            stremailmessage = stremailmessage & "<td width=""20%"" bgcolor = """ & strHolder & """>" & AdoRec("Machine Name") & "</td>"
            stremailmessage = stremailmessage & "<td width=""30%"" bgcolor = """ & strHolder & """>                 stremailmessage = stremailmessage & AdoRec1("Date") & " - " & AdoRec1("Time")
            Else
                stremailmessage = stremailmessage & "N/A"
            End If
            stremailmessage = stremailmessage & "</td><td width=""20%"" bgcolor = """ & strHolder & """>"
            If AdoRec("Connection Type") = "BroadBand" Then
                    stremailmessage = stremailmessage & AdoRec("Machine Interval Time") & " Hours"
            Else
                    stremailmessage = stremailmessage & AdoRec("Machine Update Time")
            End If
            stremailmessage = stremailmessage & "</td><td width=""20%"" bgcolor = """ & strHolder & """>"
            If Not AdoRec1.EOF Then
                stremailmessage = stremailmessage & intHours & " hours"
            Else
                stremailmessage = stremailmessage & "N/A"
            End If
            stremailmessage = stremailmessage & "</td></tr>"
            stremailmessage = stremailmessage & "</Table></Body></HTML>"
ASKER CERTIFIED SOLUTION
Avatar of Preece
Preece
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of intertise
intertise

ASKER

yes I realized that after as well. However it didnt change the problem. I'll try to validate it right now.
I guess it would help if you could post a jpeg...
Hi, intertise.

I noticed a missing quote mark after:

stremailmessage = stremailmessage & "<td width=""30%"" bgcolor = """ & strHolder & """> . Beyond that, as long as each "stremailmessage = stremailmessage &" statement follows the & with text surrounded by quotes, you should get what you need.

Also, in the same line I mentioned above with the missing quote, hit Enter to create a new line. Currently it is:

stremailmessage = stremailmessage & "<td width=""30%"" bgcolor = """ & strHolder & """>                 stremailmessage = stremailmessage & AdoRec1("Date") & " - " & AdoRec1("Time")
Should be:

stremailmessage = stremailmessage & "<td width=""30%"" bgcolor = """ & strHolder & """>"
stremailmessage = stremailmessage & AdoRec1("Date") & " - " & AdoRec1("Time")

And following this code you have:

Else
       stremailmessage = stremailmessage & "N/A"
End If

We need the intial If statement to proceed this...
Typo, meant "precede this..."
Can you post the whole lot of the code? Maybe then I can replace it by better code.
You could try Chr(34) instead of " in the string.