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
' 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")
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."
'============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
office 2010,office2007,windows 764bit,corel x5
October 19, 2012 3:15 PM
October 19, 2012 4:19 PM