Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2007

Tip: Looking for answers? Try searching our database.

reference to FileSystemObject

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Allen_N - 16 Jan 2007 07:16 GMT
Excel VBA on my work PC throws errors when I try to refer to the class
'FileSystemObject' or its associated constants (such as 'WindowsFolder').

Which library is the one I need a reference to?

Thanks!
NickHK - 16 Jan 2007 07:27 GMT
Assuming scripting is not disabled, you need add a reference
(Tools>References) to "Microsoft Scripting Runtime".

NickHK

> Excel VBA on my work PC throws errors when I try to refer to the class
> 'FileSystemObject' or its associated constants (such as 'WindowsFolder').
>
> Which library is the one I need a reference to?
>
> Thanks!
Peter T - 16 Jan 2007 15:11 GMT
Just to add, without the reference you could use late binding but subject to
scripting not disabled as Nick mentioned. You would need to declare all
related object variables "As Object" and use numeric values instead of named
constants and would loose intellisence, eg

Sub test()
Dim oFSO As Object

   On Error GoTo errH
   Set oFSO = CreateObject("Scripting.FileSystemObject")
   For i = 0 To 2
       Debug.Print oFSO.GetSpecialFolder(i)
   Next
   Exit Sub

errH:
   MsgBox Err.Description
End Sub

Regards,
Peter T

> Assuming scripting is not disabled, you need add a reference
> (Tools>References) to "Microsoft Scripting Runtime".
[quoted text clipped - 7 lines]
> >
> > Thanks!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.