For some reason Excel 2016 switches to a different workbook when I run a macro. There is no code that indicates this is happening. I've tried to switch the focus back using
Appworkbook.Activate
but it only works if I put a breakpoint there. I've tried sleep as well. It works fine on Excel 2010 and the macro does what it is supposed to do.
Has anyone experienced similar?
*****SOLUTION (Not ideal!)*****
I ended up fixing this issue but adding a new button and calling the macro from a button_click method. I have no idea wy that worked and assigning the macro to the button didn't.
I ended up fixing this issue but adding a new button and calling the macro from a button_click method. I have no idea why that worked and assigning the macro to the button didn't.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.