PC Review


Reply
Thread Tools Rate Thread

Can I set up Outlook (2002) to automatically save attachments?

 
 
=?Utf-8?B?bm9ybWFuZF82?=
Guest
Posts: n/a
 
      14th Jul 2005

 
Reply With Quote
 
 
 
 
Andreas Roeder
Guest
Posts: n/a
 
      15th Jul 2005


Sub SaveAttachment()
'Declaration
Dim myItems, myItem, myAttachments, myAttachment As Object
Dim myOrt As String
Dim myOlApp As New Outlook.Application
Dim myOlExp As Outlook.Explorer
Dim myOlSel As Outlook.Selection

'Ask for destination folder
myOrt = InputBox("Destination", "Save Attachments", "C:")

On Error Resume Next

'work on selected items
Set myOlExp = myOlApp.ActiveExplorer
Set myOlSel = myOlExp.Selection

'for all items do...
For Each myItem In myOlSel

'point on attachments
Set myAttachments = myItem.Attachments

'if there are some...
If myAttachments.Count > 0 Then

'add remark to message text
myItem.Body = myItem.Body & vbCrLf & _
"Removed Attachments:" & vbCrLf

'for all attachments do...
For i = 1 To myAttachments.Count

'save them to destination
myAttachments(i).SaveAsFile myOrt & _
myAttachments(i).DisplayName

'add name and destination to message text
myItem.Body = myItem.Body & _
"File: " & myOrt & _
myAttachments(i).DisplayName & vbCrLf

Next i

'for all attachments do...
While myAttachments.Count > 0

'remove it (use this method in Outlook XP)
'myAttachments.Remove 1

'remove it (use this method in Outlook 2000)
myAttachments(1).Delete

Wend

'save item without attachments
myItem.Save
End If

Next

'free variables
Set myItems = Nothing
Set myItem = Nothing
Set myAttachments = Nothing
Set myAttachment = Nothing
Set myOlApp = Nothing
Set myOlExp = Nothing
Set myOlSel = Nothing

End Sub

Hi,
have found this code on www.outlookcode.com to save attachments


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I set up Outlook 2007 to automatically save attachments? Mike_EV Microsoft Outlook BCM 1 12th Apr 2008 04:44 AM
How to I get Outlook to automatically save attachments vs opening =?Utf-8?B?Uw==?= Microsoft Outlook Discussion 3 7th Feb 2007 02:55 PM
how do I set up an outlook rule to automatically save attachments. =?Utf-8?B?ZGFuIGIgLSBHQQ==?= Microsoft Outlook Discussion 1 4th Nov 2004 07:22 PM
Automatically viewing picture attachments in Outlook 2002 dalefax Microsoft Outlook 2 19th Dec 2003 09:35 PM
Save Outlook attachments to PC folder automatically Rahul Microsoft Outlook 1 19th Aug 2003 05:20 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:05 AM.