-
View Multiple attachments Code
I attach code I found on another site that will open/view multiple picture attachments inside an email. Is there a way of getting a single instance of an application instead of multple windows for each picture so by clicking a button on the toolbar all attachments are opened alongside each other. Is there a way of modifying the code below ?
Here is the code
[vba]
Sub ViewAttachments()
On Error Resume Next
Dim olApp As Outlook.Application
Dim olNS As Outlook.NameSpace
Dim olFolder As Outlook.MAPIFolder
Dim olMsg As Outlook.MailItem
Dim olAttach As Outlook.Attachment
Dim strSavePath As String
Set olApp = New Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
Set olFolder = olNS.GetSharedDefaultFolder(olApp.Session.CurrentUser, olFolderInbox)
Set olMsg = olApp.ActiveExplorer.Selection.Item(1)
For Each olAttach In olMsg.Attachments
strSavePath = "c:\Windows\Temp\" & olAttach.FileName
olAttach.SaveAsFile (strSavePath)
Shell ("explorer.exe " & strSavePath)
Next
End Sub
[/vba]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules