mexmanz
09-19-2013, 02:28 AM
Hi,
The following code works fine in Outlook 2007, but when I transfer to a different PC running OL2010 it does not?
I do not receive any error, it just doesn't save the email attachment.
I have an email file attachment which lands in Outlook daily at midnight and this code saves (and overwrites) the file each time it arrives.
The macro runs via an email rule, which triggers this code and also runs an executable (global macro) file.
------------------------
Public Sub SaveStockFile(itm As Outlook.MailItem)
'This code will Save and Overwrite a SINGLE email attachment to
'the selected folder with the selected name.
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
'Change folder path as required
saveFolder = "c:\temp\"
For Each objAtt In itm.Attachments
'Change filename as required
'Change file extension if required?
objAtt.SaveAsFile saveFolder & "\" & "DailyStockFile" & ".csv"
'This code will save the file with the same name as it was received, in the selected folder above
'objAtt.SaveAsFile saveFolder & "\" & objAtt.DisplayName
Set objAtt = Nothing
Next
End Sub
---------------------------
This is the OL-Rule, it runs a simple audio mute macro, which works fine. But this was just to test, the final macro will have alternative function.
10593
In the above scenario, the executable functions correctly in 2007&2010, the macro only works in 2007?
Thanks for your help
Andrew
The following code works fine in Outlook 2007, but when I transfer to a different PC running OL2010 it does not?
I do not receive any error, it just doesn't save the email attachment.
I have an email file attachment which lands in Outlook daily at midnight and this code saves (and overwrites) the file each time it arrives.
The macro runs via an email rule, which triggers this code and also runs an executable (global macro) file.
------------------------
Public Sub SaveStockFile(itm As Outlook.MailItem)
'This code will Save and Overwrite a SINGLE email attachment to
'the selected folder with the selected name.
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
'Change folder path as required
saveFolder = "c:\temp\"
For Each objAtt In itm.Attachments
'Change filename as required
'Change file extension if required?
objAtt.SaveAsFile saveFolder & "\" & "DailyStockFile" & ".csv"
'This code will save the file with the same name as it was received, in the selected folder above
'objAtt.SaveAsFile saveFolder & "\" & objAtt.DisplayName
Set objAtt = Nothing
Next
End Sub
---------------------------
This is the OL-Rule, it runs a simple audio mute macro, which works fine. But this was just to test, the final macro will have alternative function.
10593
In the above scenario, the executable functions correctly in 2007&2010, the macro only works in 2007?
Thanks for your help
Andrew