rename excel workbooks.

G

Guest

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
 
G

Guest

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")
 
G

Guest

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

Guest

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top