Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set focus to Excel App in automation

Status
Not open for further replies.

ninjamyst

Programmer
Jan 28, 2005
21
US
Hi. I have created an application with an embedded excel. My problem is when a user clicks on something on my application that is not part of excel, excel looses focus (which is expected). However, when I click back on Excel, Excel still doesn't regain focus. I have to double click in order to scroll or use any Excel toolbars/menus or edit cell. Is there any way to reactivate Excel? I have tried doing Workbook.activate, Worksheet.activate, and even SomeRange.activate/SomeRange.select.
 
Hi

Couls you please explain what is the PRIMARY application, and exactly where in the code, this is occurring. (post the code)

Skip,

[glasses] [red]Be advised:[/red] When you ignite a firecracker in a bowl of vanilla, chocolate & strawberry ice cream, you get...
Neopolitan Blownapart! [tongue]


 
Hi,

I solved the problem. But to clarify, my main application is just a visual basic form that allows users to manipulate excel files in an embedded instance of excel along with using application-specific functions. Excel is automated/embedded using createObject and binding the excel window to a control on the form. The solution is to catch the selectionChange event and do excelApp.visible = true which I guess forces excel to repaint itself which gives it focus as a consequence.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top