Outlook 2016 - converting Word VBA to default Outlook message

Status
Not open for further replies.

CynthiaB

New Member
Outlook version
Outlook 2016 64 bit
Email Account
Exchange Server
I've been tasked with automating a paper-based procedure, and have done so successfully in Word. Now I'm being asked if this can be moved over to Outlook - and I don't know anything about coding in Outlook at all. I am self-taught in Word and only know how to get a few basic things done.

The purpose of the form is to have a maintenance person at a client site pull up the email on this phone/tablet, open a new mail to send to the client, reporting on specific conditions at their site. The "To", "CC" and "BCC" will always be the same - a part of the "Subject" line will always be the same. When they open the new message, the idea is that the body will be pre-populated with the same fields and headers every time. Is there a way to accomplish this? I've attached my code from Word below; I need to know how to have this automatically go into the body of the email, without losing functionality of the control boxes. TIA.


Sub SnowClearingAudit_Healthcare_EmailTemplate()
'
' SnowClearingAudit_Healthcare_EmailTemplate
'

'SiteA : A-WING | West | BBQ Area - pre-defined by client
'

Selection.Font.Bold = wdToggle
Selection.TypeText Text:="Date "
Selection.Font.Bold = wdToggle
Selection.TypeText Text:="(yyyy.mm.dd)"
Selection.Range.ContentControls.Add (wdContentControlDate)
Selection.ParentContentControl.Title = "Date"
Selection.ParentContentControl.Tag = "Date"
Selection.ParentContentControl.LockContentControl = True
Selection.MoveRight unit:=wdCharacter, Count:=15
Selection.TypeParagraph
Selection.TypeParagraph

Selection.Font.Bold = wdToggle
Selection.TypeText Text:="Time "
Selection.Font.Bold = wdToggle
Selection.TypeText Text:="(24hr - i.e.: 0600 or 1800): "
Selection.Range.ContentControls.Add (wdContentControlText)
Selection.ParentContentControl.Title = "Time"
Selection.ParentContentControl.Tag = "Time"
Selection.ParentContentControl.LockContentControl = True
Selection.MoveRight unit:=wdCharacter, Count:=35
Selection.TypeParagraph
Selection.TypeParagraph

Selection.Style = ActiveDocument.Styles("Intense Quote")
Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
Selection.TypeText Text:="Site A: A-WING | West | BBQ Area"
Selection.TypeParagraph

Selection.Font.Bold = wdToggle
Selection.TypeText Text:="Temperature "
Selection.Font.Bold = wdToggle
Selection.TypeText Text:="(oC)"
Selection.MoveLeft unit:=wdCharacter, Count:=2
Selection.MoveLeft unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.Font.Superscript = wdToggle
Selection.MoveRight unit:=wdCharacter, Count:=3
Selection.TypeText Text:=": "
Selection.Range.ContentControls.Add (wdContentControlText)
Selection.ParentContentControl.Title = "Temp"
Selection.ParentContentControl.Tag = "Temp"
Selection.ParentContentControl.LockContentControl = True
Selection.MoveRight unit:=wdCharacter, Count:=35
Selection.TypeParagraph
Selection.TypeParagraph

Selection.Font.Bold = wdToggle
Selection.TypeText Text:="P/SAL:"
Selection.Font.Bold = wdToggle
Selection.TypeText Text:=" "
Selection.Range.ContentControls.Add (wdContentControlDropdownList)
Selection.ParentContentControl.Title = "P/SAL"
Selection.ParentContentControl.Tag = "P/SAL"
Selection.ParentContentControl.LockContentControl = True
Selection.ParentContentControl.DropdownListEntries.Clear
Selection.ParentContentControl.DropdownListEntries.Add Text:= _
"Choose an item.", Value:=""
Selection.ParentContentControl.DropdownListEntries.Add Text:="Yes", Value _
:="Yes"
Selection.ParentContentControl.DropdownListEntries.Add Text:="No", Value:= _
"No"
Selection.MoveRight unit:=wdCharacter, Count:=17
Selection.TypeParagraph
Selection.TypeParagraph

Selection.Font.Bold = wdToggle
Selection.TypeText Text:="SS:"
Selection.Font.Bold = wdToggle
Selection.TypeText Text:=" "
Selection.Range.ContentControls.Add (wdContentControlDropdownList)
Selection.ParentContentControl.Title = "SS"
Selection.ParentContentControl.Tag = "SS"
Selection.ParentContentControl.LockContentControl = True
Selection.ParentContentControl.DropdownListEntries.Clear
Selection.ParentContentControl.DropdownListEntries.Add Text:="Choose an item.", Value:=""
Selection.ParentContentControl.DropdownListEntries.Add Text:="Yes", Value:="Yes"
Selection.ParentContentControl.DropdownListEntries.Add Text:="No", Value:="No"
Selection.MoveRight unit:=wdCharacter, Count:=17
Selection.TypeParagraph
Selection.TypeParagraph

Selection.Font.Bold = wdToggle
Selection.TypeText Text:="PO:"
Selection.Font.Bold = wdToggle
Selection.TypeText Text:=" "
Selection.Range.ContentControls.Add (wdContentControlDropdownList)
Selection.ParentContentControl.Title = "PO"
Selection.ParentContentControl.Tag = "PO"
Selection.ParentContentControl.LockContentControl = True
Selection.ParentContentControl.DropdownListEntries.Clear
Selection.ParentContentControl.DropdownListEntries.Add Text:="Choose an item.", Value:="Choose an item."
Selection.ParentContentControl.DropdownListEntries.Add Text:="Yes", Value:="Yes"
Selection.ParentContentControl.DropdownListEntries.Add Text:="No", Value:="No"
Selection.MoveRight unit:=wdCharacter, Count:=17
Selection.TypeParagraph
Selection.TypeParagraph

Selection.Font.Bold = wdToggle
Selection.TypeText Text:="CONDITIONS:"
Selection.Font.Bold = wdToggle
Selection.TypeText Text:=" "
Selection.Range.ContentControls.Add (wdContentControlDropdownList)
Selection.ParentContentControl.Title = "Conditions"
Selection.ParentContentControl.Tag = "CONDITIONS"
Selection.ParentContentControl.LockContentControl = True
Selection.ParentContentControl.DropdownListEntries.Clear
Selection.ParentContentControl.DropdownListEntries.Add Text:="Choose and item.", Value:="Choose an item."
Selection.ParentContentControl.DropdownListEntries.Add Text:="S.S.", Value:="S.S."
Selection.ParentContentControl.DropdownListEntries.Add Text:="P.O.", Value:="P.O."
Selection.ParentContentControl.DropdownListEntries.Add Text:="D/DS", Value:="D/DS"
Selection.ParentContentControl.DropdownListEntries.Add Text:="C.C.", Value:="C.C."
Selection.ParentContentControl.DropdownListEntries.Add Text:="W.S.", Value:="W.S."
Selection.ParentContentControl.DropdownListEntries.Add Text:="N.I.", Value:="N.I."
Selection.ParentContentControl.DropdownListEntries.Add Text:="B.S.H.", Value:="B.S.H."
Selection.ParentContentControl.DropdownListEntries.Add Text:="M.O.C.", Value:="M.O.C"
Selection.ParentContentControl.DropdownListEntries.Add Text:="F.S.R.", Value:="F.S.R."
Selection.ParentContentControl.DropdownListEntries.Add Text:="S.N.", Value:="S.N."
Selection.ParentContentControl.DropdownListEntries.Add Text:="L.F.", Value:="L.F."
Selection.ParentContentControl.DropdownListEntries.Add Text:="W.", Value:="W."
Selection.ParentContentControl.DropdownListEntries.Add Text:="D.", Value:="D."
Selection.ParentContentControl.DropdownListEntries.Add Text:="H.W.", Value:="H.W."
Selection.MoveRight unit:=wdCharacter, Count:=17
Selection.TypeParagraph
Selection.TypeParagraph

Selection.Font.Bold = wdToggle
Selection.TypeText Text:="NO ICE:"
Selection.Font.Bold = wdToggle
Selection.TypeText Text:=" "
Selection.Range.ContentControls.Add (wdContentControlDropdownList)
Selection.ParentContentControl.Title = "NoIce"
Selection.ParentContentControl.Tag = "No Ice"
Selection.ParentContentControl.LockContentControl = True
Selection.ParentContentControl.DropdownListEntries.Clear
Selection.ParentContentControl.DropdownListEntries.Add Text:="Choose an item.", Value:="Choose and item."
Selection.ParentContentControl.DropdownListEntries.Add Text:="Yes", Value:="Yes"
Selection.ParentContentControl.DropdownListEntries.Add Text:="No", Value:="No"
Selection.MoveRight unit:=wdCharacter, Count:=17
Selection.TypeParagraph
Selection.TypeParagraph

Selection.Font.Bold = wdToggle
Selection.TypeText Text:="COMMENTS:"
Selection.Font.Bold = wdToggle
Selection.TypeText Text:=" "
Selection.Range.ContentControls.Add (wdContentControlText)
Selection.ParentContentControl.Title = "COMMENTS"
Selection.ParentContentControl.Tag = "COMMENTS"
Selection.ParentContentControl.LockContentControl = True
Selection.ParentContentControl.MultiLine = True
Selection.MoveRight unit:=wdCharacter, Count:=35
Selection.TypeParagraph
Selection.TypeParagraph


End Sub
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
I Error saving screenshots in a custom form in outlook 2016, outlook 365 - ok in outlook 2013, outlook 2010 Outlook VBA and Custom Forms 5
R seperate read layout to design in outlook 2016..Help!! Outlook VBA and Custom Forms 3
GregS Why is Outlook 2016 mail in Outlook.com? Using Outlook 1
G Recurring tasks break links Outlook 2016 Using Outlook 5
A How to get body of all emails in outlook 2016 to view in blue color Using Outlook 1
J Edit auto-complete list in Outlook 2016+/365? Using Outlook 0
D iCloud Add-in not working in Outlook 2013 and Outlook 2016 After Windows Upgrade & iCloud Upgrade Using Outlook 2
GregS Outlook 2016 iPhone won't download Outlook 2016 Mail. Using Outlook 0
E How to display "Change Folder" in Change Default Email Delivery Location in Exchange Outlook 2016 Using Outlook 1
A How to open a specific link automatically with outlook 2016 Outlook VBA and Custom Forms 5
V Outlook 2016 will not move emails in search results Using Outlook 4
K Using Outlook 2016 to draw Using Outlook 1
M Outlook 2016 Free/Busy settings ignored Using Outlook 0
K Outlook 2016 - controlling IMAP OST size with Group Policy not working Using Outlook 1
C Outlook 2016/2019 hangs after being open for an extended period Using Outlook 4
GregS 2016 Contact List being managed by Outlook.com? Using Outlook 1
A Outlook 2016 in Cached Mode Using Outlook 1
G Outlook 2016 sync contacts directly between phone and computer using outlook 2016 Using Outlook 0
N Outlook 2016 Folder Icons Look Using Outlook 0
Marc2019 Outlook 2016 Font Problem Using Outlook 5
B Outlook 2016 Does not Shutdown Correctly Using Outlook 3
GregS Outlook 2016 Outlook 2016 stalls Using Outlook 3
H Outlook 2016 sent over 30 copies of an e-mail with attachments Using Outlook 1
Q Problems with Autodiscover Outlook 2016 Using Outlook 0
D Importing Outlook Categories from another domain (Exchange 2016/Outlook 2016) Using Outlook 4
Q Unable to Sync Quicken reminder with Outlook 2016 64Bit Using Outlook 1
J How to open OST file in Outlook 2019 & 2016 Using Outlook 1
X I have met my waterloo trying to resolve embedded graphics problem with outlook 2007 and now 2016 Using Outlook 1
K Outlook 2016 Using Outlook 0
L What are the risks of opening an Outlook 2016 .pst file in Outlook 2010? Using Outlook 4
David Langer Outlook 2016 (365) How to restore the ability to Re-Map iCloud IMAP Folders Using Outlook 5
W Search Incomplete Outlook 2016 Using Outlook 5
A Outlook 2016 not synching Using Outlook 4
B The Outlook 2016 Profile that isn't always there Using Outlook 2
D Outlook 2016 customization of incoming messages Using Outlook 1
J Command Button to stamp a date and time in a textbox in Outlook 2016 Outlook VBA and Custom Forms 3
J Checkboxes when selected will appear in a textbox in Outlook 2016 Outlook VBA and Custom Forms 1
N Outlook 2016 Address Book lookup Using Outlook 9
D Outlook 2016 automatically increment anniversaries Using Outlook 1
D Sharing outlook.com calendars in Outlook 2016 Using Outlook 1
S Adding new Exchange (2016) rule very slow down Microsoft Outlook Exchange Server Administration 0
M Outlook 2016 Requesting data from server Using Outlook 0
P Outlook 2016 Client and 365 - Groups Folder Using Outlook 3
P Add a contact to the New Task in Outlook 2016 Using Outlook 2
T Outlook 2016 is not receiving emails until I restart it Using Outlook 1
O Outlook 2016 has "Outlook 2015" files Using Outlook 2
I Retention policies on outlook 2016 ribbon Using Outlook 2
M Outlook 2016 bottom reading pane has disappeared Using Outlook 2
P Making iCloud the default calendar for Outlook 2016 Using Outlook 3
T Outlook 2016 Unresponsive 30/40+ Times A day Using Outlook 3
Similar threads


















































Top