Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Activate MS Excel
Message
From
26/06/2002 18:21:00
 
 
To
26/06/2002 15:46:03
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00672648
Message ID:
00672712
Views:
11
Mike,
Strange. I thought that if you set visible to .t., Excel receives focus. Anyway, you could use some API functions to switch between the instances. Try something like this:
DECLARE INTEGER FindWindow IN Win32api STRING, STRING
DECLARE SetForegroundWindow IN Win32api INTEGER 

*-- get VFP handle
lnVfpHandle = FindWindow(.NULL., _screen.caption)

oXls=CREATEOBJECT("excel.application")
oXls.Visible=.t.

*-- get XLS handle
lnXlsHandle = FindWindow(.NULL., oXls.caption)

*-- set focus the Excel instance
SetForegroundWindow(lnXlsHandle)

*-- set focus to VFP instance
SetForegroundWindow(lnVfpHandle)
>Hi All
>
>I've started up Excel from VFP, filled in a few cells, made Excel visible, but I can't seem to find a way to set the focus on the Excel instance.
>
>How is that done programmatically?
>
>Thanks!
Daniel
Previous
Reply
Map
View

Click here to load this message in the networking platform