Solved

Help on VBSCript Font and color

Posted on 2016-09-13
1
110 Views
Last Modified: 2016-09-17
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
Comment
Question by:Ferhat Er
1 Comment
 
LVL 28

Accepted Solution

by:
Bill Bach earned 500 total points
ID: 41796271
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we want to have a look at the directory attributes which are used by Microsoft to store the so called Security Identifiers (SID). These SIDs plays an important role in delegating and granting permissions and in authentication of trus…
Hello again, all.  For those of you that have been following along, you'll know that this is my third article on this topic (though it is not Part III).  This article is sort of remedial, and probably the topic with which I should have started the s…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question