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("S ELECT * 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!
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("S
'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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That is awesome, I am much more familiar with using Excel automation. Thanks for the excellent suggestion!
ASKER