+ Reply to Thread
Results 1 to 3 of 3

Open an attachment from an email in Outlook

Hybrid View

  1. #1
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Open an attachment from an email in Outlook

    Hi,
    You could use something like this to save the attachment to disk
    
    Sub SaveOLAttachment()
        Dim oAPP As Object
        Dim oNS As Object
        Dim oFdr As Object
        Dim oItem As Object
        Dim oAtt As Object
        
        Const olFolderInbox As Long = 6
        
        ' adjust as required
        Const cstrSAVE_PATH As String = "C:\Temp\"
        
        Set oAPP = CreateObject("Outlook.Application")
        Set oNS = oAPP.GetNamespace("MAPI")
    
        Set oFdr = oNS.GetDefaultFolder(olFolderInbox)
        Set oItem = oFdr.Items.Find("[Subject] = 'Volume'")
        If Not oItem Is Nothing Then
            If oItem.Attachments.Count > 0 Then
                Set oAtt = oItem.Attachments(1)
                oAtt.SaveAsFile cstrSAVE_PATH & oAtt.fileName
            End If
        End If
    End Sub
    Good luck.

  2. #2
    Registered User
    Join Date
    02-10-2012
    Location
    Leatherhead, England
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Open an attachment from an email in Outlook

    Thanks very much for the quick reply, I shall try this on monday and report back...
    Dru

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1