A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Saving Embedded Images in Outlook 2007



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old January 3rd 10, 02:35 AM posted to microsoft.public.outlook.program_vba
The Old Bloke[_3_]
external usenet poster
 
Posts: 2
Default Saving Embedded Images in Outlook 2007

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
  #2  
Old January 3rd 10, 05:32 PM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Saving Embedded Images in Outlook 2007



At which line do you get the error?

--
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 02:35:29 GMT schrieb 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

  #3  
Old January 3rd 10, 11:19 PM posted to microsoft.public.outlook.program_vba
The Old Bloke[_3_]
external usenet poster
 
Posts: 2
Default Saving Embedded Images in Outlook 2007

On Sun, 3 Jan 2010 18:32:54 +0100, "Michael Bauer [MVP - Outlook]"
wrote:




I don't know. This is what I see


I tried to run the macro and got this error message

http://i283.photobucket.com/albums/k...eets/error.jpg

I selected OK and then clicked Debug and got this

http://i283.photobucket.com/albums/k...eets/Debug.jpg

Nothing I tried would show me the problem line.

Regards
Doug
At which line do you get the error?

  #4  
Old January 4th 10, 07:32 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Saving Embedded Images in Outlook 2007



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:

On Sun, 3 Jan 2010 18:32:54 +0100, "Michael Bauer [MVP - Outlook]"
wrote:




I don't know. This is what I see


I tried to run the macro and got this error message

http://i283.photobucket.com/albums/k...eets/error.jpg

I selected OK and then clicked Debug and got this

http://i283.photobucket.com/albums/k...eets/Debug.jpg

Nothing I tried would show me the problem line.

Regards
Doug
At which line do you get the error?

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving images embedded in the body of the message Chappy Outlook - General Queries 8 June 5th 09 03:16 PM
Outlook 2007 message embedded images moved to file Michael Bell Outlook - Installation 0 September 21st 08 02:44 PM
All my embedded images in Outlook have disappeared Eileen Amid Outlook - General Queries 2 November 15th 07 01:56 PM
After Sending Email Cannot See Embedded Images (Outlook 2003) sg Outlook - General Queries 0 March 13th 07 01:48 PM
Outlook send embedded images as attachments M.C Outlook - General Queries 7 October 26th 06 02:56 PM


All times are GMT +1. The time now is 11:36 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.