Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Brugge, Belgium
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can't finf the method SaveAsFile in MsOutlook 12.0 (Ms Access 2007)

    In order to retrieve email attachments from inside ms access, i use the sub here underneath, i downloaded from the internet .
    Each time i run the sub and the statement "olAtt.SaveAsFile MyPath & olAtt.FileName" is reached i get the message : "cant find the method or member"
    When i type in the source "olAtt " followed by a point, I get all members and methods for the attachments, but i don't see the method "SaveAsFile"
    I use the following references in my program:
    Visual basic For Apllications
    Microsoft Access 12.0 Object library
    OLE Automation
    Microsoft Office 12.0 Access database engine object
    Microsoft Activex Data Object 2.8 library
    Microsoft Office 12.0 Object library
    Microsoft Outlook 12.0 Object library
    Microsoft ADO Ext 6.0 for DDl and security

    I must say, this error happens now and then. Sometimes all works fine and when i type in the source "olAtt." followed by a point i can see the methode SaveAsFile in the list of members
    What's going on? Is one of my references corrupt ?
    My O.S is VISTA ultimate and I use Ms Office 2007 Enterprise
    "
    By the way, the same access program on my laptop where i use as O.S, XP Prof, i always get the message: can't find "Microsoft ADO Ext 6.0 for DDl and security ". Even if i correct this by pointing to the dll in the right folder, the error don't get solved and i am obliged to use a reference to "Mcrosoft ADO Ext 2.8 for DDl and security" . Is that normal ?


    Sub SaveAttachments()

    Dim olApp As Outlook.Application
    Dim olNs As Namespace
    Dim Fldr As MAPIFolder
    Dim MoveToFldr As MAPIFolder
    Dim olMi As mailitem
    Dim olAtt As attachment
    Dim MyPath As String
    Dim i As Long

    On Error Resume Next
    Set olApp = GetObject(, "Outlook.Application")
    If Err = 429 Then
    Set olApp = CreateObject("Outlook.Application")
    End If

    Set olNs = olApp.GetNamespace("MAPI")
    Set Fldr = olNs.GetDefaultFolder(olFolderInbox)
    Set MoveToFldr = Fldr.Folders("Special")
    MyPath = "CW"

    For i = Fldr.Items.Count To 1 Step -1
    Set olMi = Fldr.Items(i)
    If InStr(1, olMi.Subject, "Geboekte orders van agent Isabelle") > 0 Then
    For Each olAtt In olMi.Attachments
    If olAtt.FileName = "Ordersverzenden_be.accdb" Then
    olAtt.SaveAsFile MyPath & olMi.SenderName & ".xls"
    End If
    Next olAtt
    olMi.Save
    olMi.Move MoveToFldr
    End If
    Next i
    Set olAtt = Nothing
    Set olMi = Nothing
    Set Fldr = Nothing
    Set MoveToFldr = Nothing
    Set olNs = Nothing
    Set olApp = Nothing

    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Can't finf the method SaveAsFile in MsOutlook 12.0 (Ms Access 2007)

    Does it make a difference if you change the line

    Dim olAtt As attachment

    to

    Dim olAtt As Outlook.Attachment

    That would rule out confusion with the Access object of the same name (which is new in Access 2007).

  3. #3
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Brugge, Belgium
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can't finf the method SaveAsFile in MsOutlook 12.0 (Ms Access 2007)

    Indeed ,you are right. This solved the problem on my desktop.
    What about the other problem on my laptop, concerning the references, i'm going to reinstall the office 2007 on it, in the hope the problem there will also be solved.
    I let you know what the result is. Thanks a lot for the help!

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Can't finf the method SaveAsFile in MsOutlook 12.0 (Ms Access 2007)

    Do you need the reference to ADO Ext. ... at all? What happens if you simply remove the reference by clearing its check box?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •