Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
FileSystemObject
I am trying to copy a file within an Excel application
using VBA 6.0. 'Help' says to use a FileSystemObject which has a Move method. But the VBA development environment will not let me Dim a variable as a FileSystemObject. Is there a library that I need to activate? Or is there a workaround with older commands? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
FileSystemObject
There are two methods really: Early binding or Late binding.
Early bind: From the VB Editor menu: Tools | References Choose Microsoft Scripting Runtime Then you can dim a variable as Scripting.FileSystemObject eg. Sub test() Dim fso As Scripting.FileSystemObject End Sub In practise, it's sometimes a good idea to late-bind: (no need to add the Microsoft Scripting Runtime reference) eg. Sub test() Dim fso As Object Set fso = CreateObject("Scripting.FileSystemObject") End Sub Someone may have a pointer to an article discussing the merits of either - I don't have one handy right now. -- Rob van Gelder - http://www.vangelder.co.nz/excel "lol" wrote in message ... I am trying to copy a file within an Excel application using VBA 6.0. 'Help' says to use a FileSystemObject which has a Move method. But the VBA development environment will not let me Dim a variable as a FileSystemObject. Is there a library that I need to activate? Or is there a workaround with older commands? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
FileSystemObject
You could add a reference to the
Microsoft scripting runtime but you may not need it if you take a look at the FileCopy statement first lol wrote: I am trying to copy a file within an Excel application using VBA 6.0. 'Help' says to use a FileSystemObject which has a Move method. But the VBA development environment will not let me Dim a variable as a FileSystemObject. Is there a library that I need to activate? Or is there a workaround with older commands? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Scripting.FileSystemObject | Excel Discussion (Misc queries) | |||
Using FileSystemObject to get File | Excel Programming | |||
Scripting.FileSystemObject LAN | Excel Programming | |||
Creating FileSystemObject | Excel Programming | |||
Help with FileSystemObject? | Excel Programming |