Late binding to reference open email? (1 Viewer)

sbflood

Registered User.
Local time
Today, 01:16
Joined
Feb 26, 2014
Messages
16
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?

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
 

sbflood

Registered User.
Local time
Today, 01:16
Joined
Feb 26, 2014
Messages
16
Thanks, but I've already read a lot about late binding and can't seem to find the correct way to reference an opened email like the Inspector and CurrentItem do. Help specific to my code would be appreciated.
 

GinaWhipp

AWF VIP
Local time
Today, 01:16
Joined
Jun 21, 2011
Messages
5,899
Hmm, I tired... I thought being able to set the Late Binding would alleviate your issue. I'll move along.
 

Users who are viewing this thread

Top Bottom