PDA

View Full Version : Macro works in Outlook 2007, but not 2010?



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

mrojas
09-23-2013, 03:05 PM
Have you compared the "References" between PC running 2007 and 2010? Maybe you're missing a DLL?

Paul_Hossler
09-28-2013, 07:06 PM
I had similar issues moving my Outlook OTM around

Try the VBE, Tools, References, and see if any are #MISSING.

Uncheck those, close, reopen, and see if it works

Paul

Habib5
10-26-2013, 10:09 AM
:friends: