Question : return an email object's guid

I have an access application opens up a new outlook email message when the user clicks on a button.  It also inserts a record into a table to record this event.  We would like to insert the value of the GUID into one of the fields on this table.  

Question - how do I obtain the value of the GUID for this email?  Do I need an API call for this?

I am including the code for the routine which creates the outlook message.

The return value would be text like this:
000000001A447390AA6611CD9BC800AA002FC45A09000CE0E416C660304DB1D88F34941145C90000000032FC00000CE0E416C660304DB1D88F34941145C9000000007E8200000000000038A1BB1005E5101AA1BB08002B2A56C20000454D534D44422E444C4C00000000000000001C830210AA6611CD9BC800AA002FC45A06

thanks,
dw

the code:

    Sub SendMessage(Recip As String, msgbody As String, msgSubject As String, DisplayMsg As Boolean, _
    Optional AttachmentPath)
          Dim objOutlook As Outlook.Application
          Dim objOutlookMsg As Outlook.MailItem
          Dim objOutlookRecip As Outlook.Recipient
          Dim objOutlookAttach As Outlook.Attachment
          ' Create the Outlook session.
          Set objOutlook = CreateObject("Outlook.Application")
          ' Create the message.
          Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
          With objOutlookMsg    Set objOutlookRecip = .Recipients.Add(Recip)
              objOutlookRecip.Type = olTo
             ' Set the Subject, Body, and Importance of the message.
             .Subject = msgSubject
          .Body = msgbody
             .Importance = olImportanceHigh  'High importance
             ' Add attachments to the message.
             If Not IsMissing(AttachmentPath) Then
                 Set objOutlookAttach = .Attachments.Add(AttachmentPath)
             End If


            ' Resolve each Recipient's name.
             For Each objOutlookRecip In .Recipients
                 objOutlookRecip.Resolve
             Next
             ' Should we display the message before sending?
             If DisplayMsg Then
                 .Display
             Else
                 .Save
                 .Send
             End If
          End With
          Set objOutlook = Nothing
End Sub

Answer : return an email object's guid

Hi vitz,

In order to be able to get the GUID from outlook, you have to set a Reference to it first (from the VB Tools menu or via VB code).

Once you've set a reference to Outlook, you can use the GUID property of the reference collection to determine the GUID of yor message.

In the MS Access help, look for:
Reference
GUID
AddFromGUID
GUIDFromString
StringFromGUID

Hope this helps,

Nosterdamus
Random Solutions  
 
programming4us programming4us