![]() |
| 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. |
|
|||||||
| Tags: create, folder, outlook, present |
|
|
|
Thread Tools | Display Modes |
|
#11
|
|||
|
|||
|
1. The part "objFSO As Scripting.FileSystemObject" gets highlighted
and the error is: "Compile error: User-defined type not defined". Was wondering what this meant? It means you haven't added a reference to the Scripting Runtime library. Either do that or declare objFSO as Object. 2. I put the non-refs code of #2 in because I don't have the "IWshRuntimeLibrary" as an option in this particular installation under TOOLS REFERENCES in the VBE here at work. Nothing in your code suggests that this library is required. -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "MitchellWMA" wrote in message oups.com... Good Morning. I'm in a new contract and finally trying to implement the above script in my current O2K installation. I'm getting an error message, though, which hopefully is easy to fix; plus a question re the library in References that I can't find. The script, again, is: ************************************************** ************************************************** ************ Sub SaveAttachment() '1. Make sure you have a reference set to IWshRuntimeLibrary, ' C:\WINDOWS\system32\wshom.ocx, in Tools, References of the VBE ' -------------------------------------------------------------------- ' 2. This works without refs of 1, but you won't have ' help by IntelliSense: 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. ' -------------------------------------------------------------------- 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. The part "objFSO As Scripting.FileSystemObject" gets highlighted and the error is: "Compile error: User-defined type not defined". Was wondering what this meant? 2. I put the non-refs code of #2 in because I don't have the "IWshRuntimeLibrary" as an option in this particular installation under TOOLS REFERENCES in the VBE here at work. I tried just browsing to and selecting the "wshom.ocx" file and that gave the reference of "Windows Script Host Object Model" there, but I'm doubtful that that's what is needed though thought I'd meantion it. The wshom.ocx exists in that folder, it's just that references doesn't list IWshRuntimeLibrary. Thinking that you might have meant WshRuntimeLibrary I looked for that, but there's no reference to that, either. Could it be named something else? I looked through the tons of stuff listed, but couldn't find anything that looked similar. Anyway, thanks for any help re this. It'd be really nice to get this to work once and for all. Cheers. D |
| Ads |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| activate contact folder from public folder with "show this folder as email address book using a prf file | Frankie K. | Outlook - Using Contacts | 7 | July 25th 06 05:37 PM |
| Create a search folder to look at all emails in one folder and selected criteria in other folders | phil.whitacre@cox.net | Outlook - General Queries | 1 | April 10th 06 09:40 AM |
| Can I create a shortcut on my desktop for an Outlook folder? | missmee | Outlook - Using Contacts | 1 | March 17th 06 04:17 PM |
| Junk E-mail folder - is there a way to create a rule to delete items in this folder older than X days? | Jaycee | Outlook - General Queries | 1 | February 22nd 06 04:54 PM |
| create shortcut to folder in outlook toolbar | ehoefling@gmail.com | Outlook - General Queries | 0 | February 14th 06 09:10 PM |