Merle11
MIS
- Apr 9, 2007
- 3
Hey All, I am in the process of developing an HTA and one of my subdirectories involves a script where I extract attachments from my Outlook email. I got the script to work fine but right now it extracts all attachments from my inbox. What I want it to do is to extract attachments only from a certain sender. Here is my code
Const olFolderInbox = 6
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.GetDefaultFolder(olFolderInbox)
Set colItems = objFolder.Items
For Each objMessage in colItems
intCount = objMessage.Attachments.Count
If intCount > 0 Then
For i = 1 To intCount
objMessage.Attachments.Item(i).SaveAsFile "C:\reports\" & _
objMessage.Attachments.Item(i).FileName
Next
Const olFolderInbox = 6
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.GetDefaultFolder(olFolderInbox)
Set colItems = objFolder.Items
For Each objMessage in colItems
intCount = objMessage.Attachments.Count
If intCount > 0 Then
For i = 1 To intCount
objMessage.Attachments.Item(i).SaveAsFile "C:\reports\" & _
objMessage.Attachments.Item(i).FileName
Next