Hello,
I have a database that allows the user to click a button and append text to an open email. The code below is used to add the text and it worked great until something with the references changed for the people who are using it. I'm trying to update the code to use late binding but after several attempts haven't been able to get the ActiveInspector parts to work. Thoughts?
I have a database that allows the user to click a button and append text to an open email. The code below is used to add the text and it worked great until something with the references changed for the people who are using it. I'm trying to update the code to use late binding but after several attempts haven't been able to get the ActiveInspector parts to work. Thoughts?
Code:
myOrder = "Order Number: " & Forms![Order Dashboard]![Open Orders].Form.[Order]
myCust = "Customer: " & Forms![Order Dashboard]![Open Orders].Form.[customer name]
myMach = "Machine Number: " & Forms![Order Dashboard]![Open Orders].Form.[Machine]
myQty = "Canister Count: " & Forms![Order Dashboard]![Open Orders].Form.[Canister Count]
Dim NewMail As Outlook.MailItem, oInspector As Outlook.Inspector
Set oInspector = Outlook.ActiveInspector
If oInspector Is Nothing Then
MsgBox "No active inspector"
Else
Set NewMail = oInspector.CurrentItem
Select Case NewMail.BodyFormat
Case olFormatPlain, olFormatRichText, olFormatUnspecified
NewMail.Body = NewMail.Body
Case olFormatHTML
NewMail.HTMLBody = NewMail.HTMLBody & "<p style='font-family:calibri'>" & myOrder & "<br>" & myCust & "<br>" & myMach & "<br>" & myQty & "<\p>"
End Select
End If