SaveAsFile error using VBA, MS Access and Outlook in Office 2007

Answered SaveAsFile error using VBA, MS Access and Outlook in Office 2007

  • Thursday, June 19, 2008 10:16 PM
     
     
    Hello,

    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

All Replies