kevinh2320
Board Regular
- Joined
- May 13, 2016
- Messages
- 61
I have a button on a form configured with an On Click event to run the code shown below. My question is on the .Subject and .Body lines of this code. Right now on the .Subject line I'm using the "Me" keyword declaring the field name "CustName" to display the customers name on the Subject line. This works just fine. However, what I can't figure out is a way to combine statically entered text and field names together. For example something that would display in the Subject line as: "Dear: John Smith". With the "Dear:" being statically entered text and "John Smith" being the dynamic field "Me.CustName". I wanting to accomplish combining text and field names in both the .Subject and .Body areas of the email.
Hope this make sense and appreciate any ideas on how to get this working.
Private Sub emailPayoffCongratsLtr_Click()
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
'Generate email
With objEmail
.To = "kevin.husa@alaska.gov"
.Subject = Me.CustName
.Body = "Testing123"
.Display
End With
End Sub
Hope this make sense and appreciate any ideas on how to get this working.
Private Sub emailPayoffCongratsLtr_Click()
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
'Generate email
With objEmail
.To = "kevin.husa@alaska.gov"
.Subject = Me.CustName
.Body = "Testing123"
.Display
End With
End Sub