Saving Embedded Images in Outlook 2007

T

The Old Bloke

In Outlook 2003 I had a macro to extract embedded images.

This is it

Sub SaveAttachment()
Dim objCurrentItem As Outlook.MailItem
Dim colAttachments As Outlook.Attachments
Dim objAttachment As Outlook.Attachment

Set objCurrentItem = Application.ActiveInspector.CurrentItem
Set colAttachments = objCurrentItem.Attachments
Set strFolderpath = CreateObject("WScript.Shell")

For Each objAttachment In colAttachments
objAttachment.SaveAsFile ("D:\Doug\anni" & "\"
&objAttachment.FileName)
Next

Set objAttachment = Nothing
Set colAttachments = Nothing
objCurrentItem.Close (olDiscard)
Set objCurrentItem = Nothing

End Sub

I don't know VBA. However when I put this macro in Outlook 2007 I get
this error message

"Object variable or With block variable not set"

Can someone help me?

Regards
Doug
 
M

Michael Bauer [MVP - Outlook]

Select the first line of the code, and press f9 for a breakpoint. Then press
f8, and with f8 walk trough the code step by step. With that you can where
the error is raised.

--
Best regards
Michael Bauer - MVP Outlook
Manage and share your categories:
<http://www.vboffice.net/product.html?pub=6&lang=en>


Am Sun, 03 Jan 2010 23:19:16 GMT schrieb The Old Bloke:
 

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