James thunderbolt
Member
I have this simple ol' code of line running first when you select one of my macros;
Problem is, if the file is already open - then it will either prompt to reopen the file (without saving changes) or end the sub if you ask it not to reopen the file.
Is there a way that if the file is already open then the code just changes to activate the file instead of opening it, my haphazard attempt didn't work
Code:
Workbooks.Open Filename:="~C:\Desktop\afilehasnoname.xlsm"
Problem is, if the file is already open - then it will either prompt to reopen the file (without saving changes) or end the sub if you ask it not to reopen the file.
Is there a way that if the file is already open then the code just changes to activate the file instead of opening it, my haphazard attempt didn't work
Code:
Workbooks.Open Filename:="~C:\Desktop\afilehasnoname.xlsm"
On Error
Windows("afilehasnoname.xlsm").Activate