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

G

Guest

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!
 
N

nida

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top