James_Latimer
Active Member
- Joined
- Jan 20, 2009
- Messages
- 415
EDIT! - I've found that once i click on the Excel instance with MainWkb open then the code below works fine - it seems i have to manually activate MainWkb the first time!?!?!?!?!?! Any ideas how to get around this?
Excel 2016 / Win 10
Hello fellow Excel'ers,
I am having some trouble switching between workbooks with VBA. I am simply trying to activate a workbook but it only semi-works...
I have a variable MainWkb that has been set as my workbook. I then have another instance QCWkb that i set to Workbooks.Open(file that i want to open).
I've tried the following:
and
Although the workbook (MainWkb) is indeed activating, it is not being brought to the front. This means that i then have to minimise the opened workbook (QCWkb) before i can see my workbook (MainWkb).
I hope that this makes sense and that i'm not missing something blatantly obvious!
If anyone can shine some light on how to make another workbook activate and come to the front of the screen it would be much appreciated.
Thanks in advance.
Excel 2016 / Win 10
Hello fellow Excel'ers,
I am having some trouble switching between workbooks with VBA. I am simply trying to activate a workbook but it only semi-works...
I have a variable MainWkb that has been set as my workbook. I then have another instance QCWkb that i set to Workbooks.Open(file that i want to open).
I've tried the following:
Code:
MainWKb.Activate
Code:
MainWkb.Sheets(sheetnamehere).Activate
Although the workbook (MainWkb) is indeed activating, it is not being brought to the front. This means that i then have to minimise the opened workbook (QCWkb) before i can see my workbook (MainWkb).
I hope that this makes sense and that i'm not missing something blatantly obvious!
If anyone can shine some light on how to make another workbook activate and come to the front of the screen it would be much appreciated.
Thanks in advance.
Last edited: