SaveAsFile error using VBA, MS Access and Outlook in Office 2007
-
Thursday, June 19, 2008 10:16 PMHello,
I've written some code linked to an OnClick event for a button in MS Access. The code is used to go into an Outlook folder and save attachments from selected e-mails to a specific netwrok folder. It was working fine using Access and Outlook 2003, but when we migrated to Access and Outlook 2007, we started getting errors pertaining to the SaveAsFile property. I don't have the exact error message, but I believe it was something similar to the message below.
SaveasFile error: (object does not support method or property Saveasfile.)
Here is a code snippet:
MyPath = "S:\Info Security\SysLogs\AS400\Source\"
TemPath = "S:\Info Security\SysLogs\AS400\"x = 0
For Each objItem In objFolder.Items
If Left$(objItem.Subject, 6) = "ES7P12" Then
SrvrString = Left$(objItem.Subject, 8)
x = x + 1
ElseIf InStr(1, objItem.SenderEmailAddress, "ES7P12") > 0 Then
SrvrString = Mid$(objItem.SenderEmailAddress, 8, 8)
For Each objAtt In objItem.Attachments
FileName = MyPath & SrvrString & " " & objAtt.FileName & "_" & x & ".txt"
objAtt.SaveAsFile FileName
Next objAtt
Else
End If
Next objItem
***End Code Snippet***
Other users were able to use the same command button in Access and Outlook 2003 to save the same e-mail attachments with no problem. I looked on the web for any solutions, but couldn't find any.
Any help is appreciated.
Thanks,
TD- Moved by Riquel_DongModerator Tuesday, June 24, 2008 2:41 AM VAB issue
All Replies
-
Thursday, June 19, 2008 10:52 PM
Hi,Looks like you are in the VBA ( Visual Basic for Applications ) area here within ACCESS judging by the code.So please try either of these VBA forums.>>This forum is for VB.Net questions only, sorry.Regards,John- Marked As Answer by Ed Price - MSFTMicrosoft Employee, Moderator Friday, May 11, 2012 3:21 AM
-
Friday, May 11, 2012 3:21 AMModerator
This thread was moved into the Off Topic forum. I can move it into a specific forum for you if you want.
Thanks!
Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)
- Proposed As Answer by Ed Price - MSFTMicrosoft Employee, Moderator Friday, May 11, 2012 3:21 AM
- Marked As Answer by Ed Price - MSFTMicrosoft Employee, Moderator Friday, May 11, 2012 3:22 AM