Solved

Help on VBSCript Font and color

Posted on 2016-09-13
1
68 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBScript to list Unavailable Mapped Drives 5 45
Modification on userform and column K 47 38
Only allow one site in Internet Explorer on XenApp. 9 51
Compile Error 7 41
Unlike scripting languages such as C# where a semi-colon is used to indicate the end of a command, Microsoft's VBScript language relies on line breaks to determine when a command begins and ends. As you can imagine, this quickly results in messy cod…
Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
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…

896 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now