Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Word VBA

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 12-05-2018, 12:20 PM
Bluewhysper Bluewhysper is offline Windows 10 Office 2016
Novice
 
Join Date: Dec 2018
Location: Aurora, CO
Posts: 1
Bluewhysper is on a distinguished road
Default A little color please

Below is the code Is use to generate an email but I cannot modify any of the text to display in red. Please help.

Sub UDI_Upgrade_Scheduled_Email()
'
' UDI_Upgrade_Scheduled_Email Macro
'
'
Dim HTLMBody, FirstName, DayOfTheWeek, CalendarDate, PrimaryAsset, AssetTag, ComputerModel, HostName, Location As String
Dim Building, Floor, Room, ControlNumber, ToEmailAddress, CCEmailAddress, BCEmailAddress, LineForSubject As String
Dim NonStandardSoftware, EngineeringSoftware, CreoSoftware As String
Dim OutApp As Object
Dim OutMail As Object

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

Set OutApp = CreateObject("Outlook.Application")


Set OutMail = OutApp.CreateItem(olMailItem)
FirstName = InputBox("What is the customer's first name? ", "UDI Upgrade Schedules Email - First Name")
ToEmailAddress = InputBox("Please enter the email address for the UDI email: ", "UDI Upgrade Schedule Email - To Email Address", "@lmcp.com")
ControlNumber = InputBox("What is the Control Number? ", "UDI Upgrade Schedule Email - Control Number")
LineForSubject = ("Windows 10 Upgrade #" & ControlNumber & "")
DayOfTheWeek = InputBox("Please enter the day of the week: ", "UDI Upgrade Schedule Email - Day of the Week")
CalendarDate = InputBox("Please enter the calendar date (MM/DD/YY): ", "UDI Upgrade Schedule Email - Calendar Date")
PrimaryAsset = InputBox("Please enter the Asset Use: ", "UDI Upgrade Schedule Email - Primary Asset")
AssetTag = InputBox("Please enter the Asset Tag: ", "UDI Upgrade Schedule Email - Asset Tag")
ComputerModel = InputBox("Please enter the Computer Model: ", "UDI Upgrade Schedule Email - Computer Model")
HostName = InputBox("Please enter the Host Name: ", "UDI Upgrade Schedule Email - Host Name")
Location = InputBox("Please enter the location of the user 1-3: 1 = CO - Deer Creek (DCF), 2 = CO - Louisville (LMCT), 3 = CO - Waterton", "UDI Upgrade Schedule Email - Location")
If Location = "1" Then
Location = "CO - Deer Creek (DCF)"
End If
If Location = "2" Then
Location = "CO - Louisville (LMCT)"
End If
If Location = "3" Then
Location = "CO - Waterton"
End If
Building = InputBox("Please enter the building: ", "UDI Upgrade Schedule Email - Building")
Floor = InputBox("Please enter the floor: ", "UDI Upgrade Schedule Email - Floor")
Room = InputBox("Please enter the Room: ", "UDI Upgrade Schedule Email - Room")
CCEmailAddress = "eus-udi.fc-ssc-it@lmco.com"
On Error Resume Next
With OutMail
.To = "" & ToEmailAddress & ""
.CC = "" & CCEmailAddress & ""
'.BCC = "" & BCCEmailAddress & ""
.Subject = "" & LineForSubject & ""
HTMLBody = "Hi " & FirstName & ",<br/><br/>"
HTMLBody = HTMLBody & "Your Windows 10 upgrade has been scheduled for " & DayOfTheWeek & " " & CalendarDate & ". "
HTMLBody = HTMLBody & "We will provide you with a loaner if you need one. "
HTMLBody = HTMLBody & "There will be a backup done before the upgrade and a restore done afterwards. <br/>"
CreoSoftware = InputBox("Are there any Creo software modules n this workstation (Y or N)? ", "UDI Upgrade Schedule Email - Creo module verification", "N")
If CreoSoftware = "Y" Or CreoSoftware = "y" Then
HTMLBody = HTMLBody & "All licensed software will be re-installed as a part of this installation (Please reply with Creo modules that are needed) with the following exceptions:<br/><br/>"
End If
If CreoSoftware = "N" Or CreoSoftware = "n" Then
HTMLBody = HTMLBody & "All licensed software will be re-installed as a part of this installation with the following exceptions:<br/><br/>"
End If
HTMLBody = HTMLBody & "Unlicensed software will not be re-installed on your computer.<br/>"
HTMLBody = HTMLBody & "Personally owned software will not be re-installed on your computer.<br/>"
HTMLBody = HTMLBody & "Non-standard software already approved by NSPR can be re-installed with the help of the LM Service Desk.<br/><br/>"
NonStandardSoftware = InputBox("Is there any non-standard software needing to be manually installed (Y or N)? ", "UDI Upgrade Schedule Email - Maunal Software Query")
If NonStandardSoftware = "Y" Or NonStandardSoftware = "y" Then
HTMLBody = HTMLBody & "The following software will need to be manually installed:<br/><br/>"
AnotherNonStandardSoftware:
NonStandardSoftware = InputBox("Enter the name of the software to manually install (Q to quit) ", "UDI Upgrade Schedules Email - Non-Standard Software Name")
Else
GoTo ContinueEmailOne
End If
If NonStandardSoftware = "Q" Or NonStandardSoftware = "q" Then
GoTo ContinueEmailOne
Else
HTMLBody = HTMLBody & "" & NonStandardSoftware & "<br/>"
GoTo AnotherNonStandardSoftware
End If
ContinueEmailOne:
HTMLBody = HTMLBody & "<br/>"
HTMLBody = HTMLBody & "More information on Non-Standard Products can be found at https://lmsupport.global.lmco.com/Li...Help/NSPR.aspx .<br/><br/>"
HTMLBody = HTMLBody & "Asset Use: "
HTMLBody = HTMLBody & "" & PrimaryAsset & "<br/>"
HTMLBody = HTMLBody & "Asset Tag: "

HTMLBody = HTMLBody & "" & AssetTag & "<br/>"
HTMLBody = HTMLBody & "Computer Model:" & ComputerModel & "<br/>"
HTMLBody = HTMLBody & "Computer Name: " & HostName & "<br/>"
HTMLBody = HTMLBody & "Location: " & Location & "<br/>"
HTMLBody = HTMLBody & "Building: " & Building & "<br/>"
HTMLBody = HTMLBody & "Floor: " & Floor & "<br/>"
HTMLBody = HTMLBody & "Room: " & Room & "<br/><br/>"
HTMLBody = HTMLBody & "Please confirm the asset and location information listed above.<br/>"
HTMLBody = HTMLBody & "Is this a closed area?<br/><br/>"
HTMLBody = HTMLBody & "The assigned tech will be in contact with you on the day of your upgrade, before the scheduled upgrade starting at 3:30pm please do the following:<br/><br/>"
HTMLBody = HTMLBody & "1. Reboot the laptop or desktop.<br/>"
HTMLBody = HTMLBody & "2. If you have a laptop please enter the credentials for McAfee Encryption after the reboot.<br/>"
HTMLBody = HTMLBody & "3. Login to assure a network connection.<br/>"
HTMLBody = HTMLBody & "4. Once your desktop loads you can log off.<br/>"
HTMLBody = HTMLBody & "5. Make sure the laptop is on the docking station or plugged into a power cable and network cable. This will not work on wireless or over VPN.<br/><br/>"
HTMLBody = HTMLBody & "Once the upgrade is started please do not log back into the laptop/desktop until tomorrow morning.<br/>"
.HTMLBody = "" & HTMLBody & ""
.Display
End With
End Sub
Reply With Quote
  #2  
Old 12-05-2018, 10:46 PM
trevorc trevorc is offline Windows 7 32bit Office 2013
Competent Performer
 
Join Date: Jan 2017
Posts: 107
trevorc will become famous soon enoughtrevorc will become famous soon enough
Default

Heres a little snippet from an Access DB i made 5 years ago. you can format lots using html. look iy up online it's a world of it's own.

Code:
        myItem.Subject = "Outgoing Consignment Notification for C/N # - " & Me.Consignment_Note_Number
        myItem.HTMLBody = "<b>" & "<font size=+2>" & "Outgoing Consignment Notification     C/N #    " & "</font>" & "<font color= FF0000 >" & "<font size=+3>" & Me.Consignment_Note_Number & "</font>" & "</font>" & "</b>" & "<br>" & "<br>" & _
                          "Delivery To - " & "<b>" & "<font size=+2>" & Me.Consignment_For & "</font>" & "</b>" & "<br>" & "Via - " & "<b>" & "<font size=+2>" & Me.Courier & "</font>" & "</b>" & _
                          "&nbsp" & " on " & "&nbsp" & "<b>" & "<font size=+2>" & Format(Me.Date_Dispatched, "dd mmm yyyy") & "</font>" & "</b>" & "<br>" & "<hr width= 500 align= left>" & _
                          "Consignment Type " & "<b>" & "<font size=+2>" & Forms![consignment note tracking Outgoing].Consignment_Type & "</font>" & "</b>" & _
                          " Description " & "<b>" & "<font size=+2>" & Me.Description_of_Goods & "</font>" & "</b>" & "<br>" & _
                          "Number of items Dispatched " & "<font size=+2>" & "<b>" & Me.Number_of_items_listed & "</b>" & "</font>" & _
                          "     Total Weight " & "<b>" & "<font size=+2>" & Me.Weight & "</font>" & "</b>" & " Kg." & "<br>" & "<br>" & _
                          "Attention to - " & "<b>" & "<font size=+2>" & Me.Attention_to & "</font>" & "</b>" & "<br>" & _
                          "P/O or Invoice # Reference - " & "<b>" & "<font size=+2>" & Me.po_or_invoive_reference & "</font>" & "</b>" & "<br>" & "<br>" & _
                          "Notes - " & "<b>" & "<font size=+2>" & Me.Notes & "</font>" & "</b>" & "<br>" & "<br>" & _
                          "Thank you." & "<br>" & "Logistics department. " & "<hr width= 500 align= left>" & _
                          "<img src='" & email_logo & "'>" & "<br>" & "<br>" & _
                          "<font color= " & logo_color & ">" & "Any views expressed in this Communication are those of the individual sender and do not necessarily reflect the views of  " & _
                          Me.Delivery_From & ". This e-mail is confidential and the copyright of " & Me.Delivery_From & _
                          ". If you are not the intended recipient of this communication please delete and destroy it immediately. " & _
                          "So far as is permitted by law " & Me.Delivery_From & " makes no guarantee regarding the integrity of this communication." & "</font>"
Reply With Quote
  #3  
Old 12-05-2018, 11:01 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 1,166
Guessed has a spectacular aura aboutGuessed has a spectacular aura aboutGuessed has a spectacular aura about
Default

Which parts do you want to be Red?

Refer to resources like https://www.w3schools.com/tags/att_font_color.asp for the syntax involved in making something red in HTML.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA change font color to background color donaldadams1951 Word VBA 6 05-31-2018 04:36 PM
Macro to change an RGB table cell shading color to another RGB color David Matthews Word VBA 4 05-29-2018 02:45 PM
Advanced Font Color Manipulation In Word: Inserting another color than the surrounding text stuartg Word 1 02-20-2017 12:38 AM
Remove white text background (keeping the font color and page color intact cc3125 Word 1 10-26-2015 06:44 PM
I created a custom XML color scheme. How do I add that to the Built-in Color? Cassik PowerPoint 5 11-04-2013 02:08 PM


All times are GMT -7. The time now is 01:41 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft