View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
K Dales K Dales is offline
external usenet poster
 
Posts: 131
Default Moving Directories

If you include a reference to the "Microsoft Scripting
Runtime" library you can use the MoveFolder method of the
FileSystemObject object:

Dim fs as Object

Set fs = CreateObject("Scripting.FileSystemObject")
fs.MoveFolder source, destination

Where source and destination are your paths.

See Help on the MoveFolder method for details, but this
should work in one step - i.e. no need to step through the
folder contents.

-----Original Message-----
Hi, I would like to write a macro that would move a named
directory including the word and excel files inside it,
from one directory to another.

Example - move directory called 12345

source = c:\system\live\ and destination =

c:\system\dead\
so the existing path would be c:\system\live\12345

The user would be prompted for the name of the directory
to be moved (in this case 12345) by an input box.

Thank you.
Robert Pollock.

PS : Would the directory move with it's contents from one
command, or would the contents have to be named in
variables ?


.