PDA

View Full Version : Solved: Save document with new filename, close it and re-open original file



sb003848
08-06-2009, 09:37 AM
Hello,

I'm currently using a macro that once launched, it will save the file under a different filename before making some changes to the file.

The new file is kept as a backup in case we mess up the original file.

Is there a way to tell the macro to do the following steps:

1) Save the file in question (Already doing that in my macro)
2) Open the original file I need to make changes to (Already doing that in my macro)
3) Close the new file that was just created (This is where I need help)

It would be easy to put something like:
Windows("New filename.xls").Activate
ActiveWindow.Close

The problem is that the new file name is always different (I save it with the date in it).

Is there a way to copy the new filename once it's saved and then tell the macro to close that window??? This way, the macro would always have the "correct" filename to close...

Thanks for your help!!!

mdmackillop
08-06-2009, 09:39 AM
You can use SaveCopyAs to make a backup copies, which keeps the original open for working.

sb003848
08-06-2009, 09:48 AM
WOW!!! This is exactly what I needed...

Thanks again for your help!!!