Link to home
Start Free TrialLog in
Avatar of Sheli Van Laningham
Sheli Van Laningham

asked on

Background Color to header row in HTML

I am automating a report in Access using HTML and want a table included.  I've gotten that far, but what I also want to do is put background color to the header row.  Here is what I have:

Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim strHTML As String
Dim rst As DAO.Recordset
Dim cnt As Long
 
    Set rst = CurrentDb.OpenRecordset("SELECT * FROM END_Late_EmailFR_q")
    'WHERE VenName = '" & Forms!frmTemplate!Owner & "'")
   
 If Not rst.EOF Then
        strHTML = strHTML & "<table border=""1"" align=""Left"">" & vbCrLf
        For cnt = 0 To rst.Fields.Count - 2
        strHTML = strHTML & " <b> <th> " & rst(cnt).Name & "</th> " & vbCrLf

        Next cnt
    Do While Not rst.EOF
        strHTML = strHTML & "  <tr bgColor = '#FF000'>" & vbCrLf
        For cnt = 0 To rst.Fields.Count - 2
        strHTML = strHTML & "    <td>" & rst(cnt) & "</td>" & vbCrLf
        Next cnt
        strHTML = strHTML & "  </tr>" & vbCrLf
        rst.MoveNext
    Loop
        strHTML = strHTML & "</table>" & vbCrLf
    End If

I've also tried this: style='color:blue:' in place of bgColor = '#FF000'

Thank you for your help!
ASKER CERTIFIED SOLUTION
Avatar of Nick67
Nick67
Flag of Canada 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 Sheli Van Laningham
Sheli Van Laningham

ASKER

Thank you!  This is my first go at HTML, so thank you for the explanation and the solution!!
SOLUTION
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
That is awesome, I am much more familiar with using Excel automation.  Thanks for the excellent suggestion!