Sounds like I gave you a reference to the wrong library. Try using Scripting
for the FileSystemObject and early binding (Intellisense). That's
\Systeme32\Scrrun.dll. Use that without Michael's Object declaration for fso
and his set line.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
"StargateFanFromWork" wrote in message
...
The script involved is this one, a very slightly modified version of the
one kindly provided by Ken Slovak:
************************************************** ************************************************** **********
Sub SaveEmbeddedGraphics()
'1. Make sure you have a reference set to IWshRuntimeLibrary,
' C:\WINDOWS\system32\wshom.ocx, in Tools, References of the VBE (Ken
Slovak)
' --------------------------------------------------------------------
' 2. This works without refs of 1, but you won't have
' help by IntelliSense: (Michael Bauer)
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
' Use this code above if you don't have the option in 1. above.
' If 1. is available, "blank" out these 2 lines above with ' in front.
(me, is this correct?)
' --------------------------------------------------------------------
Dim objCurrentItem As Outlook.MailItem
Dim colAttachments As Outlook.Attachments
Dim objAttachment As Outlook.Attachment
Dim objFSO As Scripting.FileSystemObject
Dim strPath As String
Dim strFolder As String
Set objCurrentItem = Application.ActiveInspector.CurrentItem
Set colAttachments = objCurrentItem.Attachments
Set objFSO = CreateObject("Scripting.FileSystemObject")
strPath = "(path to desktop)\Desktop\"
strFolder = "Outlook embedded graphics\"
strPath = strPath & strFolder
If Not (objFSO.FolderExists(strPath)) Then
objFSO.CreateFolder (strPath)
End If
For Each objAttachment In colAttachments
objAttachment.SaveAsFile (strPath & objAttachment.FileName)
Next
Set objAttachment = Nothing
Set colAttachments = Nothing
Set objCurrentItem = Nothing
Set objFSO = Nothing
End Sub
************************************************** ************************************************** **********
1. In the original message, I'm advised to:
"Make sure you have a reference set to IWshRuntimeLibrary
(C:\WINDOWS\system32\wshom.ocx) in Tools, References"
I don't have this listed in TOOLS REFERENCES of the VBE (or even a
WshRuntimeLibrary). I browsed to the wshom.ocx listed above and selected
it just in case that might do the trick and now I have a listing called
"Windows Script Host Object Model" in References. But don't know if that
overcomes the lack of a IWshRuntimeLibrary or WshRuntimeLibrary.
2. So bottom line is that the above macro still doesn't work. Don't know
if lack of this library above is what is causing problems. What does
happen when I invoke the macro is that it enters the VBE and gives the
following error message:
"Compile error:
User-defined type not defined"
and "objFSO As Scripting.FileSystemObject" is then highlighted in yellow.
Can someone pls advise how this might be fixed? Much appreciated.
Thanks.
D