I embedded Excel into a visual basic application and I want to know how to set focus back to Excel after Excel loose focus. My problem is that I disabled all the Excel toolbars and menus so only the worksheet shows up. I also protected the worksheet from editing. I have some controls on my form that when a control (such as a treeview) is clicked, I want to switch focus to Excel so users can start scrolling right away. Also, when someone click anywhere on the worksheet, I want to activate the scrollbars. Right now, the only way to get scrollbar to work is by double clicking a cell, which generates an error message because of the protection. I have searched through the forum and faqs, and the solution of AppActivate does not work for me.
Here's what I have tried so far:
1. AppActivate("Microsoft Excel") but I get error for invalid procedure call or argument. I guess this is because I am using an embedded Excel.
2. Me.Controls(mExcelApp).SetFocus with mExcelApp declared as WithEvents Excel.Application . That didn;t work either.
3. mExcelWorksheet.Select, mExcelWorksheet.Activate
Thanks!!
Here's what I have tried so far:
1. AppActivate("Microsoft Excel") but I get error for invalid procedure call or argument. I guess this is because I am using an embedded Excel.
2. Me.Controls(mExcelApp).SetFocus with mExcelApp declared as WithEvents Excel.Application . That didn;t work either.
3. mExcelWorksheet.Select, mExcelWorksheet.Activate
Thanks!!