VBA to copy sent email subject and to fields

1,050 pts.
Tags:
CorelDRAW
Macros
outlook2010
outloook 2007
VBA
We use a Corel X5 macro along with Outlook 2007&2010 here to send or "export" drawings from our art dept to the sales dept. The macro creates an email with the attached sketch and subject line filled in. I need to modify it to save the current sent email, subject and "TO" fields to a text file. The following code works, except it saves the currently focused email information, not the one the macro creates. That is when you have outlook open and have an email highlighted, you run the marco, the email you have highlighted gets saved, not the one the macro creates to send. The user is in Outlook and cannot go into, contacts or some other area of Outlook, otherwise the macro does not run. Can anyone assist me in re-doing this so it will save the new email? This will run in Corel X5 and higher ===============MACRO BEGINS=============================== ' Open in Outlook Dim strAnswer1, strAnswer2, strFolderName 'gets level and type for sketch strAnswer1 = InputBox("Input level please") strAnswer2 = InputBox("Input type please: r=revison s=sold p=print o=original") strFolderName = "c:sketch_subject" Dim olApp As Outlook.Application Set olApp = CreateObject("Outlook.Application", "localhost") Set myItem = Explorers.Item(1).Selection.Item(1) Dim olNs As Outlook.Namespace Set olNs = olApp.GetNamespace("MAPI") olNs.Logon Dim olMail As Outlook.MailItem Set olMail = olApp.CreateItem(olMailItem) olMail.Subject = "Sketch #" & sketch olMail.Body = "Attached is sketch #" & sketch & ". Please respond if any changes are required." olMail.Attachments.Add (FilePath) olMail.Display '============saves email as file name for export myItem.SaveAs strFolderName & "" & olMail.Subject & ";" & olMail.To & ";" & strAnswer1 & ";" & strAnswer2, olTXT '& ":" & strAnswer1 & ":" & strAnswer2 & ".txt", olTXT On Error GoTo LoopEnd Do While Application Is Not Error ActiveDocument.Undo Loop End ===================MACRO ENDS===============================

Software/Hardware used:
office 2010,office2007,windows 764bit,corel x5
ASKED: October 19, 2012  3:15 PM
UPDATED: October 19, 2012  4:19 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following