Re: Reusing FileSystemObject Object by Phill
Phill
Wed Oct 12 06:23:43 CDT 2005
<Sean S - Perth>; "WA" <SeanSPerthWA@discussions.microsoft.com> wrote in
message news:431D3569-3E2C-46CA-863F-307C71A8B000@microsoft.com...
> If I create a FileSystemObject Object is it appropriate to reuse it to
> perform operations on different files/folders?
Yes, absolutely.
In fact, I took it as far as creating a function that returns me an
instantiated FileSystemObject, rather than creating it myself in all
the odd little functions I might want to use it, as in
Dim g_oFSO ' as FileSystemObject
Set g_oFSO = Nothing
Function FSO() ' as FileSystemObject
If g_oFSO Is Nothing Then
Set g_oFSO = CreateObject( "Scripting.FileSystemObject" )
End If
Set FSO = g_oFSO
End If
HTH,
Phill W.