Solved

Help on VBSCript Font and color

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

759 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

19 Experts available now in Live!

Get 1:1 Help Now