You are viewing limited content. For full access, please sign in.

Question

Question

outlook automatically saves document to network drive based on subject

asked on February 9, 2016 Show version history

I have created this VB but I'm having issues getting it to save to the network so that I can have either Import Agent or Quickfields grab it and process it.

 

Public Sub saveAttachtoDisk(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
saveFolder = "C:\Temp"
    For Each objAtt In itm.Attachments
        objAtt.SaveAsFile saveFolder & "\" & objAtt.DisplayName
        Set objAtt = Nothing
    Next
   
End Sub

 

Please note that I am going to change the C:\Temp to a location on the network that IA or QF has rights too.

0 0

Replies

replied on February 9, 2016 Show version history

Bonnie - Where specifically are you having trouble?  Any error messages?  Is the script balking at instantiating the Outlook objects or when you actually try to save the attachments?

Here is a cleaned up copy of the source with some improvements (which might not fix the specific problem...);

    Public Sub saveAttachtoDisk(itm As Outlook.MailItem)
	    Dim saveFolder As String = "C:\Temp"
	    For Each objAtt As Outlook.Attachment In itm.Attachments
	        objAtt.SaveAsFile saveFolder & "\" & objAtt.DisplayName
	    Next
	End Sub

 

0 0
replied on February 10, 2016

I cannot get it to save to the network or my temp directory.

0 0
replied on February 10, 2016

when I try to use your version I get the following error:  'Compile error:  Expected:  end of statement at the String = "C:\Temp"

0 0
replied on February 10, 2016

Do you have other conditions set on the rule you are using the script for? I use the same script for automatically moving specific outlook attachments to a shared drive on my network and have no errors/issues with it.  

0 0
replied on February 16, 2016

As a follow up... I recreated the logic, and then set up some additional options - works like a charm now.  Thank you for all your help.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.