vba Reference to original message when reply in Outlook 2007

Hi-

Wondering how I can reference the properties of an email that I am replying to in VBA?  e.g. after clicking on reply, how do I reference e.g. the EntryID of the message that I am replying to?  Is there some parent/child relationship or some other means that links the 2 mailitems?

Example scenario: I click reply and want to append the EntryID of the message I am replying to to the subject line of the reply?

Or during what event can I save the EventID to a string from the mailitem that is current when the reply button is clicked?

Hoping someone has got the answers for me!

Thanks-
SAbboushiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris BottomleySoftware Quality Lead EngineerCommented:
When clicking reply the 'original' item still is in focus so simply call getid to return the value of the entry id:

myvar = getid()

Add the function to a normal code module

The harder part is actually detecting the reply event ... but it can use the code you received earlier if the inspector based code is agreeable.

Private Sub myItem_ReplyAll(ByVal Response As Object, Cancel As Boolean)
    Response.Subject = Response.Subject & getid()
    Response.ReplyRecipients.Add "norm@norman.com"
    Response.BCC = "doris@doris.com"
End Sub


Chris
Function getID() As String
Dim collectionItems As Variant

    If TypeName(Application.ActiveWindow) = "Explorer" Then
        Set collectionItems = Application.ActiveExplorer.Selection
        If Application.ActiveExplorer.Selection.Count = 1 Then
            Set collectionItems = Application.ActiveExplorer.CurrentFolder.Items
        Else
            Set collectionItems = Application.ActiveExplorer.Selection
        End If
    ElseIf TypeName(Application.ActiveWindow) = "Inspector" Then
        Set collectionItems = Application.ActiveInspector.CurrentItem
    Else
        Exit Function
    End If
    
    getID = collectionItems.EntryID

End Function

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Chris BottomleySoftware Quality Lead EngineerCommented:
within the constraints identified ... i.e. using the inspector object as previously accepted in another question then the post made meets the request.  Ultimately of course it is up to the author to indicate any problems ... but the lack of post implies the post meets the requirement ... since I believe from my tests that the post is correct

Chris
0
SAbboushiAuthor Commented:
Chris - my apologies for the hassle -- I dropped the ball on this one.

I have not had the time to test this out.  Your track record with me gives me confidence that it will work as you suggest ; )
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Outlook

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.