PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming Macro to automate opening attachments? (sender is trusted source)

Reply

Macro to automate opening attachments? (sender is trusted source)

 
Thread Tools Rate Thread
Old 11-11-2005, 01:08 AM   #1
=?Utf-8?B?U3VlVA==?=
Guest
 
Posts: n/a
Default Macro to automate opening attachments? (sender is trusted source)


I regularly receive an email containing other emails as attachments (maybe
100). These attached emails themselves contain attachments (hpgl or pdf files
- one per email) which I need to extract to a folder on our network (so that
I can run a batch process on them). I divert the incoming mails to a
dedicated subfolder in Outlook (2003) - I need a macro which I can run on
this subfolder. (The sender is a trusted source - so I know that these
particular emails are safe, not malicious.)

I'm "just a secretary" and new to VBA (but learning rapidly) so please be
gentle with me!

  Reply With Quote
Old 13-11-2005, 06:19 PM   #2
nida
Guest
 
Posts: n/a
Default Re: Macro to automate opening attachments? (sender is trusted source)

Hello Sue

As you said you are learning rapidly so i will only include bare code.

code:
set oFolder1 = onms.GetDefaultFolder(olInbox)
set oFolder2 = oFolder1.Folders("Name of Folder here")

for each i in oFolder2.items
for each i1 in i.attachments.items
...saveas here
next
next

note: if your attachment is by itself a mailitem, it is a bit trickier
- you need to save the attachment as ".msg" file and open it again by
creatiing a new mailitem object from template (CreateFromTemplate) then
look into this mailitem for your attachments.

this is just an attempt to show you how it is done, however if you
require the full working code i will post it on the site or to your
email address.

Hope that helps,

Nida Sharar

  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

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