Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JT JT is offline
external usenet poster
 
Posts: 234
Default opening folders within a folder

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula to go into sub folders of main folder and get values from BadBoy Excel Worksheet Functions 0 January 15th 10 10:55 PM
Hyperlink to folder only brings up Explorer's Folders view Bob W Excel Discussion (Misc queries) 0 January 21st 08 02:49 PM
Looping through folders and using the first file in each folder Conan Kelly Excel Programming 2 September 28th 06 04:23 AM
How to decide folder-depth or How to select more folders/subfolders (folder-tree) ? Subteam Excel Discussion (Misc queries) 2 May 7th 06 08:14 PM
delete all the contents (sub folders and files) in the temp folder Joseph Excel Discussion (Misc queries) 0 June 6th 05 08:01 AM


All times are GMT +1. The time now is 05:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"