Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default reference to FileSystemObject

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!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default reference to FileSystemObject

Assuming scripting is not disabled, you need add a reference
(ToolsReferences) to "Microsoft Scripting Runtime".

NickHK

"Allen_N" wrote in message
...
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!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default reference to FileSystemObject

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

"NickHK" wrote in message
...
Assuming scripting is not disabled, you need add a reference
(ToolsReferences) to "Microsoft Scripting Runtime".

NickHK

"Allen_N" wrote in message
...
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!





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
FileSystemObject help please. DaveO Excel Programming 0 July 11th 05 08:33 AM
FileSystemObject help please. Tom Ogilvy Excel Programming 0 July 8th 05 04:44 PM
Filesystemobject Help CyndyG Excel Programming 4 May 17th 05 01:00 AM
filesystemobject Alvin Hansen[_2_] Excel Programming 2 February 16th 05 03:47 PM
Help with FileSystemObject? Ed[_9_] Excel Programming 2 August 5th 03 12:08 AM


All times are GMT +1. The time now is 10:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"