Outlook 2016 - converting Word VBA to default Outlook message

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
 

Similar threads

Top