rename excel workbooks.

J

jnewl

i have 2 excel books that are generated from an access program, after a
series of updates.

one book is labelled as 'facility - followed by name and date
the other is 'non facility - followed by name and date

i would like to open each book and save as facility.xls and nonfacility.xls

i can then send these generic books back into access for updating.

i can open an excel book if i have the exact path and name and save as
facility or non facility. but when the name changes, i do not know how to
code for that

i tried using the asterisk as a wild card but that did not work.

is there a way to retrieve these different books?

thanks much for your help
 
M

Mark

jnewl said:
i have 2 excel books that are generated from an access program, after a
series of updates.

one book is labelled as 'facility - followed by name and date
the other is 'non facility - followed by name and date

i would like to open each book and save as facility.xls and nonfacility.xls

i can then send these generic books back into access for updating.

i can open an excel book if i have the exact path and name and save as
facility or non facility. but when the name changes, i do not know how to
code for that

i tried using the asterisk as a wild card but that did not work.

is there a way to retrieve these different books?

thanks much for your help
See if the Dir() function will help you.

From the help file:

' Returns filename with specified extension. If more than one *.ini
' file exists, the first file found is returned.
MyFile = Dir("C:\WINDOWS\*.INI")
 
J

jnewl

that works fine for the first one. but i have another file below that is
labelled non facility. how do i fetch that one?
 
B

BrerGoose

Did you use:
strFile1=Dir("C:\Facility*.xls")
strFile2=Dir("C:\NonFacility*.xls")
 
Top