craigexcel
Active Member
- Joined
- Jun 28, 2006
- Messages
- 298
- Office Version
- 2016
- Platform
- Windows
I have created a 'utility' workbook that contains a number of macros that coworkers & I use for various processes. Since each of the processes to be completed is always done on a workbook that a user opens, I'd like to automate always returning to the previously 'active' workbook. I've been searching for a while for a solution but have yet to come up with one.
I tried both of these in the "This Workbook" module's Autpen event, without success, and in fact, it didn't look like anything happened. (1) Application.SendKeys ("%{TAB}"), and (2) some version of "... .ActivatePrevious" (but I already deleted that one, instead of just commenting it out, since it didn't work, and I don't remember what the rest of it was).
So, my question is: does VBA code exist that will, once the 'utility' workbook has been opened, the user is immediately returned to the (still open) workbook that was just the 'active' workbook?
I'm using Office 365 (i.e. Excel 2016).
I tried both of these in the "This Workbook" module's Autpen event, without success, and in fact, it didn't look like anything happened. (1) Application.SendKeys ("%{TAB}"), and (2) some version of "... .ActivatePrevious" (but I already deleted that one, instead of just commenting it out, since it didn't work, and I don't remember what the rest of it was).
So, my question is: does VBA code exist that will, once the 'utility' workbook has been opened, the user is immediately returned to the (still open) workbook that was just the 'active' workbook?
I'm using Office 365 (i.e. Excel 2016).