View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default opening folders within a folder

Look in the vba help index for NAME. It will actually MOVE the files.
Name Statement Example
This example uses the Name statement to rename a file. For purposes of this
example, assume that the directories or folders that are specified already
exist. On the Macintosh, €œHD:€ is the default drive name and portions of the
pathname are separated by colons instead of backslashes.

Dim OldName, NewName
OldName = "OLDFILE": NewName = "NEWFILE" ' Define file names.
Name OldName As NewName ' Rename file.

OldName = "C:\MYDIR\OLDFILE": NewName = "C:\YOURDIR\NEWFILE"
Name OldName As NewName ' Move and rename file.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"JT" wrote in message
...
I have a template in each cost center's folder on a corporate drive.
Occassionally, I will need to replace those templates in each folder due
to
fixes, enhancements, etc. I'm looking to write a macro that will go
though
each cost center folder, open it, delete the existing template, copy the
new
template into the cost center folder, and then move to the next cost
center
and repeat these steps.

I can delete the template and copy the new one in but I'm having trouble
cycling though the cost center folders.

Following is the drive and a sampling of the cost center folders that I
need
to cycle through. I'm only showing a few but when this is fully
implemented
I could have to replace 150 or templates and I don't want to do this one
by
one.

P:\Accounts Receivable\Cost Centers\10A
P:\Accounts Receivable\Cost Centers\15C
P:\Accounts Receivable\Cost Centers\21D
P:\Accounts Receivable\Cost Centers\33A

Any help with the code to cycle through all of the folders within the
"Cost
Centers" and open each cost center folder would be greatly appreciated.

Thanks for the help......

--
JT