• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 415
  • Last Modified:

Help on VBSCript Font and color

Hi Guys,

I have the following script and require the HTMLBody section test to be to Arial size 10, colour > custom > RGB 0, 66, 138

Can anyone please assist with this?


Dim datYesterday, strDDMMYY, myStart, myMessage, myattachment, strEmail, HTMLBody

datYesterday = DateAdd("d", -1, Now())
strDDMMYY = Right("0" & Day(datYesterday), 2) & Right("0" & Month(datYesterday), 2) & Right(Year(datYesterday), 2)
strEmail = Right("0" & Day(datYesterday), 2) & "/" & Right("0" & Month(datYesterday), 2) & "/" & Right(Year(datYesterday), 2)

myattachment = "N:\Users\Production\ops\Ops Documents\PCOMB Errors\Pcomb Error Report " & strDDMMYY &".doc"
myMessage = "PCOMB Timings & Error Report " & strDDMMYY

Set outlookApp = CreateObject("Outlook.Application")

olMailItem = 0
Set newMessage = outlookApp.CreateItem(olMailItem)

newMessage.To = "test@hotmail.com"
newMessage.Subject = myMessage
newMessage.Attachments.Add "N:\Users\Production\ops\Ops Documents\Spreadsheets and templates\PCOMB_Timings.xls"
newMessage.Attachments.Add "N:\Users\Production\ops\Ops Documents\PCOMB Errors\Pcomb Error Report " & strDDMMYY &".doc"
newMessage.Display
newMessage.HTMLBody = "<br>Good Morning,<br><br>Please find attached the PCOMB Timings and Error Report for " & strEmail & ".<br>" & newMessage.HTMLBody

newMessage.Display

Regards,
Ferhat
0
Ferhat Er
Asked:
Ferhat Er
1 Solution
 
Bill BachPresidentCommented:
This is not really a VBScript issue -- it is an HTML issue.  Your best option is to embedd a CSS for the paragraph tag, and then change your text to use that tag.

To make this easier, I recommend FIRST making a simple little HTML file on your desktop with the sample message, and then add the necessary tags.  For example, this might do it for you:

<head>
<style>
p {
    font-family: "Arial"; font-size: 10px; color: rgb(0,66,138);
}
</style>
</head>
<body>
<p>Good Morning,</p><p>Please find attached the PCOMB Timings and Error Report for " & strEmail & ".</p>
</body>

Open in new window


Note: I didn't test this -- just a quick mockup.  Anyway, once you get the exact display that you want, you can then translate THAT to the VBScript code for the Email.  If you wanted to avoid accessing the head/style element, you could also use inline styles, but this will make your text a bit longer and harder to update in the future.
1

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now