Okay, so I finally have my code set so it pulls the data from a table and it's all nice and pretty....but I have a few questions.
1. Can I force a certain font type in this email? I have a coworker who likes to use green comic sans (no joke) and we don't want that going out to our customers.
2. Can I bold the variable "workOrder" in the body of the email?
3. Can I make it so the "Building", "Floor" and "Pillar" only appear if those fields are filled in? So I don't have something that looks like this:
Building:
Floor:
Pillar:
Thanks again for everything...my little brain feels so full!
1. Can I force a certain font type in this email? I have a coworker who likes to use green comic sans (no joke) and we don't want that going out to our customers.
2. Can I bold the variable "workOrder" in the body of the email?
3. Can I make it so the "Building", "Floor" and "Pillar" only appear if those fields are filled in? So I don't have something that looks like this:
Building:
Floor:
Pillar:
Thanks again for everything...my little brain feels so full!
Code:
Code:
Private Sub sendResponse_Click()
Dim email$, ref$, notes$, strBody$, strBody2$
Dim workOrder As Long
Dim Building$, custServ$, strCC$, strWhere$
Dim objOutlook As Object
Dim objEmail As Object
custServ = "DTMB-customerservice@michigan.gov"
strWhere = "Building = '" & Me.Building & "'"
strCC = Nz(DLookup("emailCC", "tblBuilding", strWhere), "")
UserName = Me!UserName & "@michigan.gov"
ref = Me!ref
notes = Me!notes
If Me!workOrder = notNull Then
workOrder = Me!workOrder
' Else
' workOrder = "N/A"
End If
If Me!Building = notNull Then
Building = Me!Building
' Else
' Building = "N/A"
End If
If Me!Pillar = notNull Then
Pillar = Me!Pillar
End If
If Me!Floor = notNull Then
Floor = Me!Floor
End If
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(outlookMailItem)
strBody = "Thank you for contacting DTMB Customer Service Center. Work order number " & workOrder & " has been created for your most recent request:" & vbNewLine & vbNewLine & "Request Details: " & notes _
& vbNewLine & "Building: " & Building & vbNewLine & "Floor: " & Floor & vbNewLine & "Pillar: " & Pillar
strBody2 = "If you have questions relating to this request, please reference the work order number when you contact the DTMB Customer Service Center at 517.373.6227 or DTMB-CustomerService@michigan.gov." & vbNewLine & vbNewLine & "Thank you!"
With objEmail
.To = UserName
.CC = strCC
.SentOnBehalfOfName = "DTMB-customerservice@michigan.gov"
.Subject = "Customer Service Center Follow Up"
.Body = strBody & vbNewLine & vbNewLine & strBody2
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next
.Display 'sends the email in Outlook. Change to DISPLAY if you want to be able to
'modify or see what you have created before sending the email
End With
End Sub