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

Do I need to dl the library(??); how to fix error message?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 8th 07, 09:38 PM posted to microsoft.public.outlook.program_vba
StargateFanFromWork
external usenet poster
 
Posts: 39
Default Do I need to dl the library(??); how to fix error 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


Ads
  #2  
Old May 8th 07, 10:51 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Do I need to dl the library(??); how to fix error 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.

--
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



  #3  
Old May 8th 07, 11:30 PM posted to microsoft.public.outlook.program_vba
StargateFanFromWork
external usenet poster
 
Posts: 39
Default Do I need to dl the library(??); how to fix error 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. D

--
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



  #4  
Old May 9th 07, 07:29 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Do I need to dl the library(??); how to fix error message?

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. D


 




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
Library LXBBPRP.DLL. Error: 126. Stan Outlook - Calandaring 1 May 7th 07 03:58 AM
runtime library error message Jo Lee Outlook Express 3 February 8th 07 01:01 AM
Email Message Forms in Personal Forms Library Debbie Hadsel Outlook - Using Forms 4 May 30th 06 06:11 PM
Error publishing a Form to Organizational Forms Library unable to go to folder BobH Outlook - Using Forms 4 April 13th 06 11:40 AM
Can't Print - Library Not Found - Error Code 0 Bill Wolcott Outlook Express 3 March 10th 06 11:21 AM


All times are GMT +1. The time now is 11:53 AM.


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