Hi
I have a piece of code where I need to copy data from one XLS file to another. Now I have 3 Excel files open - the one with the macro, the source and destination.
The filenames of source and destination can vary. I need to switch frequently between source and destination. So, I have this piece of code:
This works fine:
Windows("source.xls").Activate
But this doesn'twork:
sourceWin = dir(path)
Windows(sourceWin).Activate
Note: 'path' is the variable in which user enters the file path. dir(path) gives me the file name correctly.
Any idea what I'm missing?
I have a piece of code where I need to copy data from one XLS file to another. Now I have 3 Excel files open - the one with the macro, the source and destination.
The filenames of source and destination can vary. I need to switch frequently between source and destination. So, I have this piece of code:
This works fine:
Windows("source.xls").Activate
But this doesn'twork:
sourceWin = dir(path)
Windows(sourceWin).Activate
Note: 'path' is the variable in which user enters the file path. dir(path) gives me the file name correctly.
Any idea what I'm missing?