Consulting

Results 1 to 2 of 2

Thread: help wanted.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    help wanted.

    Hello everyone

    I need some help with the script below, it's working great but i would like to add a additional function to it.

    I work with this script within outlook (rules).

    When i receive a email from a certain supplier (invoices) it's now been saved to a certain folder, so far so good!
    However i also would like that the script automatically prints the attachment (.pdf) that comes with the email.

    I am not known with vba scripts....

    Can somebody help me with this??

    Thanks in advance

    Alfred

    Public Sub saveAttachtoDisk(itm As Outlook.MailItem)
    Dim objAtt As Outlook.Attachment
    Dim saveFolder As String
    saveFolder = "C:\data\Docs"
         For Each objAtt In itm.Attachments
              If InStr(objAtt.DisplayName, ".pdf") Then
              objAtt.SaveAsFile saveFolder & "\" & objAtt.DisplayName
            End If
            Set objAtt = Nothing
         Next
    End Sub

  2. #2
    I found the solution myself:

    Now the scrips works just fine.

    Public Sub saveAttachtoDisk(itm As Outlook.MailItem)
    Dim objAtt As Outlook.Attachment
    Dim saveFolder As String
    saveFolder = "H:\minox\Data\A0021115\Docs"
         For Each objAtt In itm.Attachments
              If InStr(objAtt.DisplayName, ".pdf") Then
              objAtt.SaveAsFile saveFolder & "\" & objAtt.DisplayName
              Shell """C:\Program Files\Adobe\Reader 11.0\Reader\acrord32.exe"" /h /p """ + saveFolder & "\" & objAtt.DisplayName + """", vbHide
            End If
    Set objAtt = Nothing
    Next
    End Sub

Tags for this Thread

Posting Permissions

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