Opening and saving a file from a macro


Posted by Steve D on May 15, 2001 12:34 PM


I have a process that I do daily that formats text files (saved as .xls) into an Excel worksheets that my users can understand. I have written the macros to format the individual files but I do the same process for multiple files. I spend a ton of time opening a file, running the macro and then saving the file. The issue I’m having trouble with is that the files have a date attached on the file name that changes daily.

For example:
FileName Day 1 FileName Day +1
bkrev_cb_05-13-01.xls bkrev_cb_05-14-01.xls
bkrev_inf_05-13-01.xls bkrev_inf_05-14-01.xls

What I'd like to be able to do is open the cb file (always from the same directory), call the formatting macro, and then save the formatted worksheet with the date at the end of the file name to a directory (always the same one) other than where I opened the file from. Then do the same process for the rest of my files.

I know that is a tall order, but any help would be appreciated.

Thanks
Steve

Posted by Barrie Davidson on May 15, 2001 2:20 PM

Hi Steve, have a look at
16414.html

Barrie



Posted by Steve D on May 16, 2001 8:48 AM

Still need help with the file names part

Barrie, thanks.
The loop is a great idea.
Pointed me in the right direction and hacked through the rest. Your help is most appreciated, this is gonna save me a ton of time!