MS Access - Create an email replying to a stored msg file

Hi,

I am storing emails as saved msg files for Quotes - I would like to create a new email that relies to this email so it has the thread of previous emails on it. Generating this email from Access 2010.

I have tried below but get error "Could not send the message" on line "objOutReplyMsg = objOutlookMsg.Reply"
The previous msg email displays OK - Appreciate any ideas. I have tried Forward, replyall etc but same error.

 Dim objOutlook As Object
 Dim objOutlookMsg As Object
 Dim objOutReplyMsg As Object
            
 Set objOutlook = CreateObject("Outlook.Application")
 Set objOutlookMsg = objOutlook.CreateItemFromTemplate(C:\Quote345.msg)
 objOutlookMsg.Display
 objOutReplyMsg = objOutlookMsg.Reply     '*****
 With objOutReplyMsg
       .Display
       .To = strTo
       .Subject = strsubject
       .Body = strBody
  End With

Open in new window

donhannamAsked:
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.

Rgonzo1971Commented:
Hi,

Since the the item you create with CreateItemFromTemplate has not been sent. Reply cannot be used

pls try

Dim objOutlook As Object
 Dim objOutlookMsg As Object
 Dim objOutReplyMsg As Object
            
 Set objOutlook = CreateObject("Outlook.Application")
 Set objOutlookMsg = objOutlook.CreateItemFromTemplate("c:\Quote345.msg")
 Set objOutReplyMsg = objOutlook.CreateItem(olMailItem)
 With objOutReplyMsg
       .To = objOutlookMsg.SenderName
       .Subject = "RE: " & objOutlookMsg.Subject
       YourHTMLtext = ""
       .htmlbody = YourHTMLtext  & objOutlookMsg.htmlbody
       .Recipients.Resolveall
       .Display
 End With
 objOutlookMsg.Close False

Open in new window

Regards
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
donhannamAuthor Commented:
Hi  Rgonzo

Thanks that worked well - replies to email and has previous email in body.

However it does not format it as well as if I manually reply to email in Outlook which puts header info and nice separating line from the previous email - From, date etc. I guess I could pick up this info and duplicate format but wondering if there is a way to use outlooks reply function to do this automatically?.
0
Rgonzo1971Commented:
like I said you cannot reply since the mail is not sent to you (for outlook) , you will have to reformat the text with VBA to have same "feel" as in a reply
0
donhannamAuthor Commented:
Thanks - I'll have a go at formatting header.
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
Microsoft Access

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.