View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
vetron vetron is offline
external usenet poster
 
Posts: 3
Default Opening an attachment of a message that has a message as attachmen

Lets suppose I have 2 messages in the input folder in Outlook 2000.
Each message as 2 attachments.
The first attachment of the first message is a message with 2 attachments.
Each attachment has 1 pdf document.
Like this:

Outlook 2000
---Infolder
------Message1 (has 2 attachments)
---------Attachment1 (is a message)
------------This message has an attachment: Document1.pdf.
---------Attachment2 (is a message)
------------This message has an attachment: Document2.pdf.
------Message2 (has 2 attachments)
---------Attachment n (is a message)
---------Attachment n+1 (is a message)

How can I open Document1.pdf using VBA?

So far, I have done this:

Set myOlApp = CreateObject("Outlook.Application")
Set b = myOlApp.Session.Folders("InFolder")
For x = 1 To b.Items(1).Attachments.Count
---at this point I can display the first message:
---b.items(1).display
---it is possible to save that message:
---b.items(1).attachments(x).saveasfile(c:\temp\ms g1.msg)
---but what I really want to do is to open the attachment of this message
i.e. Document1.pdf.
---How?
Next

Thanks