Welcome to Office Zealot Sign in | Join | Help

New Outlook programming article on MSDN

NOTE:
Due to data loss with OfficeZealot's blog server, all comments posted between April 28 and June 8 , 2005 to any of my blog entries were inadvertently deleted.  The end of this blog entry contains the text of the comments applicable to this posting that I was able to recover.

Update:
The source code for the MSDN article can be downloaded here.  It includes the complete form as well as the code modules.

Have you ever received an e-mail with a lot of attached picture files in Outlook?  To say the least, it is somewhat painful to double-click the little attachment icons in the message header one-by-one to view each picture.

With a little Outlook macro magic, you can easily build a nice little helper form with VBA and the Outlook Object Model to make this process far more manageable.  Full instructions are in this article on MSDN:

Office Developer Center: Viewing Multiple Picture Attachments in Outlook 2003:
http://msdn.microsoft.com/office/default.aspx?pull=/library/en-us/odc_ol2003_ta/html/Office_Outlook_ViewMultPictAttach.asp

----------------------------------------------------------------
 COMMENTS RESTORED FROM BACKUP:

Wed 4/27/2005 2:33 AM Paule

I am a extreme newbie to VBA. BUT I was tired of not being able to open multiple pictures in Outlook 2003 as I did in a prior version. When I googled to the MSDN site I was pleased to try to get the macro/script to work. I had no success. Again I Googled and found this Blog. WOW what a great site and help. It all works now plus I learned more about security digital signatures. Now my downloaded Acess templates from Microsoft work using this information. Thanks!!! ;-)

Wed 4/27/2005 10:12 PM ClearYourSix

Even better, how would I go about simplifying the procedure so that upon click of the button, it automatically opens all files in the default viewer without pulling up the userform?

Thu 4/28/2005 3:32 PM Eric Legault http://blogs.officezealot.com/legault

ClearYourSix: That wouldn't be too hard to do. Most of the code to save the attachment files and send it to a viewer is already there, you just have to move it around so that it works without the form and when called from a custom command bar button or a macro.

END COMMENTS RESTORE
 ----------------------------------------------------------------

Published Wednesday, January 12, 2005 2:10 PM by legault
Filed under: ,

Comments

# re: New Outlook programming article on MSDN

Eric -

This attachment viewer is the balls. I tweaked it slightly, added IrfanView as an option, and adjusted the code so Open All only opens Irfan View on the last file in the list. Then I can use the nav buttons in Irfan View to look at all of them in the single instance.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
http://PeltierTech.com/
_______
Wednesday, January 12, 2005 10:12 PM by Anonymous

# re: New Outlook programming article on MSDN

EXCELLENT! Somebody using my code AND improving on it!

I'm missing something - you only open IrfanView for the last file... How are the other pictures loaded?

Just wait until you see the COM Add-In version...
Thursday, January 13, 2005 8:49 AM by legault

# re: New Outlook programming article on MSDN

Excellent stuff. Implemented straight away :)
Thursday, January 13, 2005 9:54 AM by Anonymous

# re: New Outlook programming article on MSDN

This sucks. I did not buy a newer version of Office so that I could do the programming that was previously done on earlier versions. Microsoft sucks
Wednesday, January 19, 2005 3:35 PM by Anonymous

# re: New Outlook programming article on MSDN

Andrew: if you are referring to the ability in Outlook 2000 to do a "select all" on the list of attachments in the message header, I agree - they shouldn't have dropped this functionality in later versions.

However, if this functionality is important enough for you, shouldn't you have evaluated it before making your purchase?
Wednesday, January 19, 2005 3:56 PM by legault

# re: New Outlook programming article on MSDN

Can this be downloaded ready-to-go? I am in the process of implementing this but it is not working at the moment and I am wondering if it is due to the various typos. For example, the last module, LaunchPictureAttachmentsHelper, is missing an 'END IF'. There is also some text inline not indicated as a comment.

Thursday, January 20, 2005 8:20 PM by Anonymous

# re: New Outlook programming article on MSDN

got it working, but the filenames are actually just numbers "1" "2" "3" etc. the problem was that I inserted the missing "end if" I referred to in my previous post at the end of the routine rather than after the 'exit sub'
Thursday, January 20, 2005 8:24 PM by Anonymous

# re: New Outlook programming article on MSDN

ok, to make the filenames correct instead of numbers you must use 'Me.lstAtts.List(lstAtts.ListCount - 1, 0) = objAtt.FileName' instead of 'Me.lstAtts.List(lstAtts.ListCount - 1, 1) = objAtt.FileName'.
Thursday, January 20, 2005 8:30 PM by Anonymous

# re: New Outlook programming article on MSDN

I LOVE IT!
Thursday, January 20, 2005 8:31 PM by Anonymous

# re: New Outlook programming article on MSDN

Hi Peter,

within the article you write that you "...won't outline all the control-specific properties that need to be set; you can download the form source from the link at the end of the article and import it to save time, or use it as a reference to build your own GUI...".

Unfortunately I can't find any link to that in the article.

Where can I download the form source?

Thanks - Joerg
****************
mailto:joerg.bruch@web.de
Friday, January 21, 2005 6:30 AM by Anonymous

# re: New Outlook programming article on MSDN

Joerg and others: I just realized too that MS didn't include the source code in the article; I will discuss with them and/or post the source here soon.
Friday, January 21, 2005 8:17 AM by legault

# re: New Outlook programming article on MSDN

Please also have them correct the typos I have mentioned
Friday, January 21, 2005 10:05 AM by Anonymous

# re: New Outlook programming article on MSDN

Jeoff: The problem with lstAtts is that you need to change the ColumnCount property to 2 in the designer (or do it in code). ColumnWidths should also be "0;" I believe.
Friday, January 21, 2005 10:20 AM by legault

# re: New Outlook programming article on MSDN

Hi Eric,

I played a little bit with your coding because I wanted to have the option to cache all pictures first an then launch my favourite freeware picture viewer Irfanview (http://www.irfanview.com) in 'Thumbnail' mode in the directory used for caching.

Instead of having the...

varRet = Shell(strExecutePath, vbNormalFocus)

...in the Sub OpenImage after the End Select statement I've added the following:

'LAUNCH IMAGES IN DEFINED IMAGE VIEWER
Select Case lngViewerType
Case ImageViewers.Default
ShellExecute 0, "open", strImageFile, _
vbNullString, strTempFolderPath, conSwNormal
If lngTempFileCount = lstAtts.ListCount Then
lngTempFileCount = 0
End If
Exit Sub
Case ImageViewers.Custom
strExecutePath = strCustomImageViewerFilePath & " " & strImageFile
varRet = Shell(strExecutePath, vbNormalFocus)
If lngTempFileCount = lstAtts.ListCount Then
lngTempFileCount = 0
End If
Case ImageViewers.IE
strExecutePath = strIEPath & " " & strImageFile
varRet = Shell(strExecutePath, vbNormalFocus)
If lngTempFileCount = lstAtts.ListCount Then
lngTempFileCount = 0
End If
Case ImageViewers.IV
strExecutePath = strIVPath & " " & strTempFolderPath & " /thumbs"
If lngTempFileCount = lstAtts.ListCount Then
varRet = Shell(strExecutePath, vbNormalFocus)
lngTempFileCount = 0
End If
End Select


The 'new' part is the following:

Case ImageViewers.IV
strExecutePath = strIVPath & " " & strTempFolderPath & " /thumbs"
If lngTempFileCount = lstAtts.ListCount Then
varRet = Shell(strExecutePath, vbNormalFocus)
lngTempFileCount = 0
End If




So far, so good - everything worked fine until I tried to execute that on a mail with only GIF files attached. I noticed that in that case not the different files have been stored in the cache directory but a file without file extension called 'Compuserve GIF'. I debugged the coding and changed...

strImageFile = strTempFolderPath & "\" & _
objCurrentMessage.Attachments.Item(lstAtts.List( _
intListIndex, 0)).DisplayName

to

strImageFile = strTempFolderPath & "\" & _
objCurrentMessage.Attachments.Item(lstAtts.List( _
intListIndex, 0)).FileName

[changed is here the DisplayName to FileName] - and now everything works as expected by myself...

I can send you the mail with the GIF files attached (and if you want my form source as well) to see what I've changed. But I think you'll see the difference without that.

Now it's working perfect for me - thanks a lot...

_/ _/ _/ Joerg _/ _/ _/
mailto:joerg.bruch@web.de
Friday, January 21, 2005 3:53 PM by Anonymous

# re: New Outlook programming article on MSDN

This is a great idea and I appreciate the detailed instructions and code sections. However, I am such a newbie that I'm afraid I need quite a bit more explanation and direction (I'd like to order a VBA programming book- can you recommend one?)For example, i don't know exactly where to place the sections of code -- do they all go in the sequence in which they are presented in the basPictureAttachments module? Please forgive my ignorance, but remember, no one is born knowing this stuff. Oh, and I too would like to download the form source as I could'nt find the link. However, I did create the form from scratch although I don't know how well it will work. Thanks!
krob758@yahoo.com
Wednesday, January 26, 2005 6:23 PM by Anonymous

# re: New Outlook programming article on MSDN

Kathy: The source code can now be downloaded via the link at the top of this post. Good luck with the programming! See http://www.outlookcode.com for a great programming book by Sue Mosher.
Wednesday, January 26, 2005 9:26 PM by legault

# re: New Outlook programming article on MSDN

>>I'm missing something - you only open IrfanView for the last file... How are the other pictures loaded?

IrfanView shows you one picture in a directory, but you can click on the navigation arrows to switch to the others. (A dozen open IrfanView windows isn't so convenient.)

- Jon
Thursday, January 27, 2005 6:18 AM by Anonymous

# re: New Outlook programming article on MSDN

Please forgive my ignorance (nobody is born know this stuff contrary to some individual's opinions) but I downloaded the code from the link at the top of this post and I'm a bit confused. The zip file included three files - the bas, frm and frx files. I imported these into my vba project and the base module contains only two sections, the Declarations and the LaunchPictureAttachmentsHelper. So what about all of the code that was detailed and explained in the article? Not that I can't copy and paste it into the module but I was hoping to see what the format or layout of the code should be like in the module. Does it all just go in sequentially as it is discussed in the article? You're probaby going to tell me to get a book so i can get the basics down and I will. But I sure would appreciate some additional help just to get going with this neat little project. Thanks!
Sunday, January 30, 2005 4:25 PM by Anonymous

# re: New Outlook programming article on MSDN

Kathy: You need to go into the code view for the form; it's all there (just double-click the form in design mode, or select Code from the View menu).
Sunday, January 30, 2005 10:34 PM by legault

# re: New Outlook programming article on MSDN

Dear Joerg with referene to modified code feedback for Irfanview. I tried it gives me the error message i.e. Case ImageViewers.IV Method or Data member not found. It is even not showing me the list of files which I have selected. So what is the problem? Can you help in this. Thanks in advance.
Wednesday, February 16, 2005 11:03 PM by Anonymous

# re: New Outlook programming article on MSDN

Dear Joerg with referene to modified code feedback for Irfanview. I tried it gives me the error message i.e. Case ImageViewers.IV Method or Data member not found. It is even not showing me the list of files which I have selected. So what is the problem? Can you help in this. Thanks in advance.
Wednesday, February 16, 2005 11:03 PM by Anonymous

# re: New Outlook programming article on MSDN

Milind: What is the value of strExecutePath when the Shell function is called?
Monday, February 21, 2005 9:10 AM by legault

# re: New Outlook programming article on MSDN

Hi all,
What is the third file for? I was only able to load 2 files. .bas and .frm ... what is the other form binary for?
thanks,H
Thursday, March 03, 2005 4:26 PM by Anonymous

# re: New Outlook programming article on MSDN

Hoop: You mean the .frx file? Yes, it is a binary file for the form that stores control data.
Thursday, March 03, 2005 7:36 PM by legault

# re: New Outlook programming article on MSDN

I wonder ir someone could provide some details on how to import the code that can be downloaded on the top of the page into Visual Basic Editor. I've done it and save it. Then created a button for the macro but it still doesn't work. Thanks in advance for any info.
Tuesday, March 15, 2005 9:03 AM by Anonymous

# re: New Outlook programming article on MSDN

Frederico: while you are in the VBA Editor, choose "Import File" from the File menu. Repeat for each of the source files.
Tuesday, March 15, 2005 9:21 AM by legault

# re: New Outlook programming article on MSDN

I've done all the things right all from the beginning. The only problem was caused by running the macro on the previw pane. A message from another user with the same problem in (http://blogs.officezealot.com/legault/archive/2004/01/29/222.aspx) helped me to figure out what was wrong. It is pretty easy to any user to add this great Macro. The only limitation is that it will only work when opening not previewing the message. Thanks for your files and instructions.
Tuesday, March 15, 2005 9:49 AM by Anonymous

# re: New Outlook programming article on MSDN

It worked but only for a while: Outlook 2003 doesn't consider the Macro as trustworthy so it disables it after I close Outlook. The only way to run the Macro is to put the macro security level at middle making Outlook ask me every time if I want to activate macros. I have checked the option to "trust in every suplements and models installed" but if I put the security level in "High" or "Very High" the macro is disabled. Any workaround for this annoyance?
Tuesday, March 15, 2005 10:37 AM by Anonymous

# re: New Outlook programming article on MSDN

I have the same problem as Frederico, I love the program but is there a solution to the built in security?
Tuesday, March 15, 2005 11:00 AM by Anonymous

# re: New Outlook programming article on MSDN

You need to sign your VBA Project with a Digital Certificate to avoid the macro security prompts. See this link for more info:

Code Signing Office XP Visual Basic for Applications Macro Projects (Microsoft Office XP Technical Articles):
http://msdn.microsoft.com/library/en-us/dnoxpta/html/odc_dsvba.asp?frame=true
Tuesday, March 15, 2005 11:21 AM by legault

# re: New Outlook programming article on MSDN

Thanks! Creating a Digital Certificate was a pretty easy and fast task. Now the security settings are on the "High" setting and the macros runs always. Keep up the good work!
Tuesday, March 15, 2005 11:47 AM by Anonymous

# re: New Outlook programming article on MSDN

I am a extreme newbie to VBA. BUT I was tired of not being able to open multiple pictures in Outlook 2003 as I did in a prior version. When I googled to the MSDN site I was pleased to try to get the macro/script to work. I had no success. Again I Googled and found this Blog. WOW what a great site and help. It all works now plus I learned more about security digital signatures. Now my downloaded Acess templates from Microsoft work using this information. Thanks!!! ;-)
Wednesday, April 27, 2005 1:33 AM by Anonymous

# re: New Outlook programming article on MSDN

Even better, how would I go about simplifying the procedure so that upon click of the button, it automatically opens all files in the default viewer without pulling up the userform?
Wednesday, April 27, 2005 9:12 PM by Anonymous

# Animation files are not working in the outlook 2003

help it!!
Wednesday, June 22, 2005 12:01 AM by Anonymous

# re: New Outlook programming article on MSDN

Yes! Nice blog for all.
Wednesday, June 22, 2005 4:03 AM by Anonymous

# re: New Outlook programming article on MSDN

kalai: Are you talking about animated GIF images embedded in the e-mail? Or are you seeing image placeholders with a red X?
Monday, July 04, 2005 10:03 AM by legault

# re: New Outlook programming article on MSDN

Is this how Microsoft is trying to cover their mistakes?
Why didn't they make it work like outlook express?
Thursday, October 13, 2005 6:26 PM by Anonymous

# re: New Outlook programming article on MSDN

AD: They obviously should have consulted you first.
Thursday, October 13, 2005 8:57 PM by legault

# re: New Outlook programming article on MSDN

Eric,

Wonderful work. Was in the planning process for own code and found a link to yours! Thanks for saving me some time and doing such a good job!
Saturday, October 29, 2005 12:25 PM by Anonymous

# re: New Outlook programming article on MSDN

hi,

i'm hopeless and cant get this to work ..it seems like such a good idea and i get so many pictures in my emails .
Please Please Please can you help ...whats the dumb and dumber idiots guide (I've never used VBA? or anythingl ike it before)
Friday, November 04, 2005 1:08 PM by Anonymous

# re: New Outlook programming article on MSDN

Shaun: This really is only targeted to programmers. If you follow some of the previous comments and read the article carefully, all the information is there. I'd recommend the full, commercial version of the solution which has far more features. You can download a trial here: http://www.collaborativeinnovations.ca.
Friday, November 04, 2005 3:06 PM by legault

# re: New Outlook programming article on MSDN

Is there a way to tweak it to open multiple PDF's?
Thursday, December 08, 2005 9:56 AM by Anonymous

# re: New Outlook programming article on MSDN

Jeff: Have you tried to see what happens when you add .pdf to the list of extensions in the FillList procedure, and changed the executable path to Adobe's?
Thursday, December 08, 2005 7:18 PM by legault

# re: New Outlook programming article on MSDN

Tried following the instructions on the MS site with no luck. Tried following the _____ (blank, because there are no instructions on this site) with no luck. Retried the instructions on the MS site, yet get lost at "open Toolbox" because it's greyed out. Retraced my steps, with no luck. Tried opening and using the three files in your download, but couldn't figure out how to get anything to work or even cut and paste. Gee, no instructions--who woulda figured. Came back here. Can't even figure anything out after rereading several times. You people evidently have no clue how to instruct those who aren't as geeky as you are. Wish you had a rating system as MS does, so I could rate this as low as possible, too.
No, I shouldn't have to read a book on VB. If MS is going to include a link to this site to make this macro simpler to install, then this site should make it simpler to install.
Sunday, February 12, 2006 12:24 PM by Anonymous

# re: New Outlook programming article on MSDN

Mike: Do you have any experience with VBA or VB? The intended audience for the article is developers and was not meant for consumption by general users unless they have an interest in learning to program. If you are learning how to program with Outlook, then how else are you going to learn except via a book or some other documentation? Essential VBA programming basics is beyond the scope of the article.
Monday, February 13, 2006 11:41 AM by legault

# re: New Outlook programming article on MSDN

I typed in the info... got the user-defined type not defined error on 'DIM objFS AS New Scriptiong.FileSystemObject' line... so I d/l the script from above with the same error msg. Using Outlook 2003. Did I miss something? Seems like everyone else is running but me. Sorry if it is a obvious, new to programming in VB and Outlook at the same time.
Wednesday, February 15, 2006 9:55 AM by Anonymous

# re: New Outlook programming article on MSDN

Rob: You need to set a reference to the Microsoft Scripting Runtime library from the Tools -> References menu in the VBA Editor.
Thursday, February 16, 2006 2:30 PM by legault

# re: New Outlook programming article on MSDN

Hi

I enjoyed your code. however, when I click on the list box or open button I receive an error that "91 Object Variable or With block variable not set [error in OpenImage; file = '']"

Can someone help me out?
Monday, February 20, 2006 8:29 AM by Anonymous

# re: New Outlook programming article on MSDN

Hi there,

Thanks for your nice work. I am using ACDSee as my viewer now, and i wanted to minimize the step to open all pictures. So, I wrote a new sub routine base on your code and use this ViewAllAttachments as the macro instead. It'll save all the attachments and open the first one with the default, same way as IrfanView viewer is according to the previous post. Thanks again for posting your code up here.

Cheers!
Lek

=====
Private Function getTempFolderObj() As Scripting.Folder
On Error Resume Next

Dim objFS As New Scripting.FileSystemObject
Dim objTempFolder As Scripting.Folder

'GET THE TEMP FOLDER
Set objTempFolder = objFS.GetSpecialFolder(2)
'returns the path found in the TMP environment variable

If objTempFolder Is Nothing Then Exit Function

'Get or create the AttachmentsTemp folder
If objFS.FolderExists(objTempFolder & "\AttachmentsTemp") = False Then
Set objTempFolder = objFS.CreateFolder(objTempFolder & "\AttachmentsTemp")
Else
Set objTempFolder = objFS.GetFolder(objTempFolder & "\AttachmentsTemp")
End If

If Err.Number <> 0 Then Exit Function

Set getTempFolderObj = objTempFolder
End Function

Sub ViewAllAttachments()
On Error GoTo ErrHandling

If Application.ActiveInspector Is Nothing Then Exit Sub
If Application.ActiveInspector.CurrentItem.Attachments.Count = 0 Then Exit Sub

Dim objTempFolder As Scripting.Folder, objTempFile As File
Dim i As Integer

Set objTempFolder = getTempFolderObj()
If objTempFolder Is Nothing Then Exit Function

'First delete all other contents in temp folder
For Each objTempFile In objTempFolder.Files
objTempFile.Delete True
Next

'Then save all attachments
Dim objAtt As Attachment, objAtts As Attachments
Dim firstImageFileName As String

For Each objAtt In ActiveInspector.CurrentItem.Attachments
Select Case LCase(Right(objAtt.FileName, 3))
Case "jpg", "peg", "gif", "bmp", "tif", "iff"
objAtt.SaveAsFile objTempFolder.Path & "\" & objAtt.FileName
'record the first attachment filename (sorted by filename)
If firstImageFileName = "" Or firstImageFileName > objAtt.FileName Then
firstImageFileName = objAtt.FileName
End If
End Select
Next

'And open the viewer program on the first file
If firstImageFileName <> "" Then
ShellExecute 0, vbNullString, firstImageFileName, vbNullString, objTempFolder.Path, 1
End If
Exit Sub

ErrHandling:
MsgBox "Error: " & Err.Description & "(" & Err.Number & ")"
End Sub
=====
Friday, March 10, 2006 4:14 PM by Anonymous

# re: New Outlook programming article on MSDN

Helpful
Wednesday, April 26, 2006 2:33 AM by Anonymous

# re: New Outlook programming article on MSDN

I have install the code with luck and i have map the button to macro with luck too. But when i try to click the button, there is nothing happen.

I went back to VBA and try running the script with (F5) it popup the message saying that "the macros in this project is disable. please refer to the online help or documentation of the host application to determine how to enable macros".

Is there any way to show me how a newbie run this script in outlook. I just want to view the attachment more easier. If it could more like OE which can show the picture attachment as the message does then we will need no more this code.
Thursday, May 04, 2006 10:59 PM by Anonymous

# re: New Outlook programming article on MSDN

Chris: Go into Tools -> Macro -> Security and set your level to Medium and restart Outlook.
Friday, May 12, 2006 11:02 AM by legault

# re: New Outlook programming article on MSDN

Halo everyone,

I've the same problem with Chris, afterwhich I set Macro to Low. But I'm still unable to get the macro work.

Kindly Advise. Thanks.
Wednesday, July 19, 2006 2:24 AM by Anonymous

# re: New Outlook programming article on MSDN

Hi,
Can you help me?
I have a mail that I prepare and open it for the user. How can I insert an image - a .gif file into the body?
Thankyou
Anat


Outlook.Application app = new Outlook.Application();
Outlook.MailItem mail = (Outlook.MailItem)app.CreateItem(Outlook.OlItemType.olMailItem);
mail.To = Mailadd;
mail.Subject = Subject;
mail.BodyFormat = Outlook.OlBodyFormat.olFormatHTML;

mail.Body ="today is friday"
mail.Display(true);
Thursday, July 27, 2006 10:39 AM by Anonymous

# re: New Outlook programming article on MSDN

Well, among the first rules of everything that is about computers is backup!

I think there is some software for backing up blogs, but don't remember right now its name.. :(
Sunday, July 30, 2006 7:00 PM by Anonymous

# re: New Outlook programming article on MSDN

Yenny: Can you get *any* macros to work? I just want to rule out that your issues are Outlook related and not specific to my solution. Setting the security to Low *should* work, unless the VBA Add-In has been disabled (check under Help -> About -> Disabled Items).
Monday, August 14, 2006 10:03 AM by legault

# re: New Outlook programming article on MSDN

Anat: I'm assuming you don't want the .gif adding as a regular attachment, but rather displayed inline in the message body? If so, there's some great sample code here:

To add an embedded image to an HTML message in Microsoft Outlook using code:
http://www.outlookcode.com/d/code/htmlimg.htm
Monday, August 14, 2006 10:08 AM by legault

# re: New Outlook programming article on MSDN

Fantastic work, Eric. Have you ever tried using this macro in anything other than a message class (email) form? I am developing a custom contact form for my company and my users attach multiple pictures/files into the notes/comments field. Just as in an email message, they cannot open more than one of the attached files at once to view to windows picture/fax viewer. I can't figure out what to replace in your code to expand the macro to apply to all items (contact, tasks, etc), not just emails.
Monday, August 28, 2006 12:37 AM by Anonymous

# re: New Outlook programming article on MSDN

Isaac: You'd be happy to know that all you have to change is one line at the top of the code module behind frmPictureAttachments:

Dim objCurrentMessage As MailItem

Change MailItem to ContactItem, or better yet just Object, and you can process attachments in any Outlook item.
Tuesday, September 12, 2006 8:52 AM by legault

# re: New Outlook programming article on MSDN

this macro works great, thanks!

Can it be extended so that it will work when I am marking a message in the inbox pane instead of opening it as a new window? (i am trying to save a click)
Tuesday, October 03, 2006 8:26 AM by Anonymous

# re: New Outlook programming article on MSDN

Boaz: Yes you can; add a new procedure in the basPictureAttachments module:

Sub LaunchPictureAttachmentsHelperFromMainWindow()
'Map toolbar button to this macro

On Error Resume Next

If Application.ActiveExplorer.Selection.Count > 1 Then Exit Sub
If Application.ActiveExplorer.Selection(1).CurrentItem.Attachments.Count = 0 Then
Exit Sub
frmPictureAttachments.FillList
frmPictureAttachments.Show
End Sub

Your "homework" is to modify the FillList procedure so that it can handle either an ActiveInspector or one selected e-mail in a folder. I think a new MailItem argument to the FillList procedure would probably work best.
Tuesday, October 03, 2006 10:10 AM by legault

# re: New Outlook programming article on MSDN

Thanks! but I always get:Application.ActiveExplorer.Selection(1).CurrentItem.Attachments.Count = 0

even if I'm on a mail with attachment.
any ideas?
Tuesday, October 03, 2006 11:08 AM by Anonymous

# re: New Outlook programming article on MSDN

OK I've managed by using: Application.ActiveExplorer.Selection.Item(1).Attachments.Count

thanks!
Tuesday, October 03, 2006 2:14 PM by Anonymous

# Viewing Multiple Picture Attachments in Outlook 2003

Eric Legault , an Outlook MVP, wrote a new article on MSDN about opening multiple image attachments in

Thursday, February 15, 2007 5:32 PM by Kevin Harder
Anonymous comments are disabled