![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
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. ![]() |
#2
|
|||
|
|||
![]()
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. ![]() |
#3
|
|||
|
|||
![]()
"Ken Slovak - [MVP - Outlook]" wrote in message
... 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. Hi, Ken, thanks. I might be grossly misinterpreting the above but if I'm to deduce correctly, that I search for "Scripting for the FileSystemObject and early binding (Intellisense)" in the references or something close to this (?). The items in References that start with "script" are these: scripto 1.0 Type Library ScriptPW 1.0 Type Library ScriptSigner ScriptSubSys 1.0 Type Library Or do I just browse to that "scrrun.dll" file (found in "scrrun.dll") or is there something other than "script"-something? I looked under the i's for "intellisense" but nothing there. Sorry to be such a noob re this but this is all new to me lol. Cheers. ![]() -- 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. ![]() |
#4
|
|||
|
|||
![]()
Windows Scripting runtime is scrrun.dll. Use that one as the reference in
Tools, References. Then in the code use Dim fso As Scripting.FileSystemObject and you will see that as you space after As one of the choices is now Scripting. Early binding means if you type Scripting. Intellisense opens and lists the members of Scripting. Late binding is when you declare a variable as Object or Variant or don't use an As clause. Then you have no intellisense. -- 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 ... "Ken Slovak - [MVP - Outlook]" wrote in message ... 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. Hi, Ken, thanks. I might be grossly misinterpreting the above but if I'm to deduce correctly, that I search for "Scripting for the FileSystemObject and early binding (Intellisense)" in the references or something close to this (?). The items in References that start with "script" are these: scripto 1.0 Type Library ScriptPW 1.0 Type Library ScriptSigner ScriptSubSys 1.0 Type Library Or do I just browse to that "scrrun.dll" file (found in "scrrun.dll") or is there something other than "script"-something? I looked under the i's for "intellisense" but nothing there. Sorry to be such a noob re this but this is all new to me lol. Cheers. ![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Library LXBBPRP.DLL. Error: 126. | Stan | Outlook - Calandaring | 1 | May 7th 07 04:58 AM |
runtime library error message | Jo Lee | Outlook Express | 3 | February 8th 07 02:01 AM |
Email Message Forms in Personal Forms Library | Debbie Hadsel | Outlook - Using Forms | 4 | May 30th 06 07:11 PM |
Error publishing a Form to Organizational Forms Library unable to go to folder | BobH | Outlook - Using Forms | 4 | April 13th 06 12:40 PM |
Can't Print - Library Not Found - Error Code 0 | Bill Wolcott | Outlook Express | 3 | March 10th 06 12:21 PM |