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

Excel 97 VBA form focus

Status
Not open for further replies.

StevePB

Technical User
Dec 6, 2001
92
GB
I have a custom application that runs from an Excel template, which is launched from a short cut and set to run minimized.

On start up, a form is launched to get an i.d. number from the user. "OK" on this, unloads it and launches the getOpenFilename window, with a path based on the i.d.

Once a file has been chosen, it is opened and data from the file is displayed in another form.

The problem is that this last form appears, but does not receive the focus. How can I make sure this form gets the focus after it is displayed ?
 
for example:
Set that form to a pop-up and modal form
 
Thanks for your response ide.

I am loading the form with the formName.Show method. In the VBA help it says "a user form is always modal" - so I assume it must already be modal.
 
In case anyone is interested, I figured out what was causing the problem. I wanted Excel to be minimized while the form was being used, so in the click event of the button that loaded the second form I put:

[tt]Application.WindowState = xlMinimized[/tt]

- when I took this out, the form got the focus.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top