A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Tags: , , , ,

How to programmatically save all email attachments in a folder





 
 
Thread Tools Display Modes
  #1  
Old April 20th 06, 02:24 PM posted to microsoft.public.outlook.program_vba
Brian Beck
external usenet poster
 
Posts: 4
Default How to programmatically save all email attachments in a folder

I have a set of folders in a mailbox in Outlook 2003 that I need to work
with. Specifically, I want to create a procedure that will scan through a
folder and check each email for the following:

-check to see if there is an attachment, or even multiple attachments.
-If there are attachment(s), then it should save them to some specified
folder.
-If there are no attachment(s), then it should go and check the next
email.

Is that something fairly trivial to achieve in Outlook? I have experience
writing VBA scripts for Word and Access, but I haven't delved into
programming much at all for Outlook...any ideas would be greatly
appreciated.


Ads
  #2  
Old April 20th 06, 03:47 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 3,778
Default How to programmatically save all email attachments in a folder

Dim oItem As Outlook.MailItem
Dim colItems as Outlook.Items

Set colItems = oFolder.Items
For Each oItem in colItems
If oItem.Attachments.Count 0 Then
'detach attachments here
End If
Next

That snippet would be passed a MAPIFolder object. For code you can modify to
detach the attachments see
http://www.slovaktech.com/code_sampl...ripAttachments. That strips
attachments from items selected in a folder view. It can be modified to have
a specific item passed into it, just remove the For Each objMsg In
objSelection loop and the initial initialization code that sets the Outlook
object (use a global one) and the selection collection and pass in objMsg
into the Sub.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Brian Beck" wrote in message
...
I have a set of folders in a mailbox in Outlook 2003 that I need to work
with. Specifically, I want to create a procedure that will scan through a
folder and check each email for the following:

-check to see if there is an attachment, or even multiple attachments.
-If there are attachment(s), then it should save them to some specified
folder.
-If there are no attachment(s), then it should go and check the next
email.

Is that something fairly trivial to achieve in Outlook? I have experience
writing VBA scripts for Word and Access, but I haven't delved into
programming much at all for Outlook...any ideas would be greatly
appreciated.


 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programmatically populating an email but allowing user opportunity to edit zulu113cep@yahoo.com Outlook and VBA 1 April 19th 06 12:08 AM
How to differ between received and sent email programmatically Darius Add-ins for Outlook 3 April 6th 06 09:06 PM
After Sending Email: Save Copy of Message to Windows Folder Ben Outlook and VBA 1 March 25th 06 08:17 AM
How to add a bitmap footer to each outgoing email programmatically Herve cadieu Outlook and VBA 3 March 13th 06 06:39 PM
save attachments NascarDude Outlook Express 2 February 12th 06 11:36 PM


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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2008 Outlook Banter, part of the NewsgroupBanter project.
The comments are property of their posters.
Debt Help - Credit Cards UK - Free Credit Report - Free phpBB forum - Loan