I have a macro that flips back and forth coping and pasting information. But if someone renames document A, The macro wont work because it's looking for a certain document name. How can I fix this? Thanks
You didn't say if the files should have the same name all the time, or if the user is prompted to choose the file when opening it.
Regardless, I have a few suggestions which may or may not help you. The first, is to prompt the user to select the file(s) to copy to/from. Then the macro can run off the file names which are selected.
If there is a danger of the file name being changed while the macro is running, I would recommend including code that makes a copy of the files(s) when you open them (i.e. save them as TempFileA and TempFileB). The run the macros off of these copies.
If they download the excel macro off the website, or better yet, if they just open it from there, it will save on the HDD as some crazy temp. name, and the macro wont run correctly because that file needs to be named a certain file name.
I think you may need to explain a little more how exactly this program works. When you talk about the name of the file being changed, are you referring to the file with the macro or the data files? How many files are involved? How are the other files opened?
Regardless, you should be able to program the macro to copy the files (including the file containing the macro itself) to temp files in the C: drive. Basically, you are just renaming all the files involved so you will know there exact name and can invoke them.
Ok, What the macro does, it copies data from one workbook to another. The macro itself is within Workbook1.xls. Now, my macro is set up to open Workbook2, flip back to Workbook1, Copy data, flip over to Workbook2 and paste. If one of my co workers rename Workbook1... The macro cant flip back to Workbook1.xls during the macro because that file has a new name.