Hello,
Kind of new to VBA in Word, but I have an opportunity to use it.
I want to know if it is possible to count the number of files in a
directory. My ultimate goal is to save a file as <filenametext??> where the
"??" is the filenumber count + 1. If that is too hard I can just add a
msgbox with the next file name and have the user save the file manually.
The need for this macro is to help users save a copy of a protected document
in the proper directory with the proper name. My plan is to write a
procedure that would fire automatically when the user tries to type onto a
protected document.
Thanks,
Jim

Re: Count files in diectory by Word

Word
Sun Dec 14 16:00:55 CST 2003

G'day "Jim Edwards" <HugeElvis@adelphia.net>,

yes it is. Do a DIR command with a parm of the directory name. Keep
dir'ing until its blank, counting each instance.

"Jim Edwards" <HugeElvis@adelphia.net> was spinning this yarn:

>Hello,
>Kind of new to VBA in Word, but I have an opportunity to use it.
>I want to know if it is possible to count the number of files in a
>directory. My ultimate goal is to save a file as <filenametext??> where the
>"??" is the filenumber count + 1. If that is too hard I can just add a
>msgbox with the next file name and have the user save the file manually.
>The need for this macro is to help users save a copy of a protected document
>in the proper directory with the proper name. My plan is to write a
>procedure that would fire automatically when the user tries to type onto a
>protected document.
>Thanks,
>Jim
>

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
wordheretic.com

If my answers r 2 terse, ask again or hassle an MVP,
at least they get recognition for it then.
Lengthy replies offlist require payment.