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!