View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Rename files and save them as pdf

You know what you want to do better than I, but renaming a file from .txt to
..pdf doesn't make it a pdf file.

--
Regards,
Tom Ogilvy

"gerdmain" wrote in message
...
Hi,

Suggest you have a look at the "Dir" function in VBA Help. The example
lists
all sub-directories in a given directory.

This gives you the loop you want.

Each time through the loop you get the next directory name in MyName, e.g.
"One".
Place your recorded code where the Debug.Print statement is in the example
and
replace the "one.txt" in your recorded macro with MyName & ".txt"

This should answer your questions so far.


--
Gerd


"Braca" wrote:

On Feb 10, 10:21 pm, "Rod Gill" <rod AT project-systems DOT co DOT nz
wrote:
Try recording a macro of you doing this manually. The recorded code
will
give you a great head start.


Tried it already. Recorded macro will not show me the most important
part - how to extract the name of each subfolder and assign it to the
renamed text file, and how to do all that in a loop until the last
subfolder is reached.