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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change focus from form to workbook

Status
Not open for further replies.

jackha18

Technical User
Sep 28, 2002
39
IL
Hi,
how can I programmatically switch focus from a form to workbook grid. I tried ActiveWindow.Activate - not working.
thanks.
 
depends whether the form is modal or not....

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
why 'of course' ?

Being modal, you must hide the form before you can use the workbook

You may change values etc programmatically whilst the form is up but you cannot set the focus

Try:

FormName.Hide

this will hide the form but should kepp the current values

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
However, with a little help of API call:

Code:
Private Declare Function SetActiveWindow Lib "user32.dll" (ByVal hwnd As Long) As Long

Private Sub CommandButton1_Click()
SetActiveWindow Application.hwnd
End Sub

combo
 
-----------------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top