?
Solved

Help on VBSCript Font and color

Posted on 2016-09-13
1
Medium Priority
?
246 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 28

Accepted Solution

by:
Bill Bach earned 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

801 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