ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Application.Visible = True and focus (https://www.excelbanter.com/excel-programming/381178-application-visible-%3D-true-focus.html)

hughie

Application.Visible = True and focus
 
Here's one for you..

I've got a modeless userform firing up after a 'Application.Visible =
False'. Because I want to get into the code and continue editing I've
added a 'view worksheet' button to the form that does a
'Application.Visible = True'. All is well..

...except that the worksheet is behind the userform and won't take focus
and come to the front. How can I get the two windows to behave
normally ie when you click on one it takes focus and comes to the
front?

tia,
Hughie


hughie

Application.Visible = True and focus
 
Try showing your form vbModeless

I've got a modeless userform firing up...


I thought I mentioned that it IS modeless.

H


NickHK

Application.Visible = True and focus
 
Hughie,
This works for me as expected:

<Worksheet code
Private Sub CommandButton1_Click()
UserForm1.Show vbModeless
End Sub
</Worksheet code

<Userform code
Private Sub cmdHideExcel_Click()
Application.Visible = False
End Sub

Private Sub cmdShowExcel_Click()
Application.Visible = True
End Sub
</Userform code

But the worksheet will always be behind the userform, although you can still
interact with the WS; Excel is designed that way.
You can .Hide the userform if you do not want it visible, but still loaded.

NickHK

"hughie" wrote in message
oups.com...
Here's one for you..

I've got a modeless userform firing up after a 'Application.Visible =
False'. Because I want to get into the code and continue editing I've
added a 'view worksheet' button to the form that does a
'Application.Visible = True'. All is well..

..except that the worksheet is behind the userform and won't take focus
and come to the front. How can I get the two windows to behave
normally ie when you click on one it takes focus and comes to the
front?

tia,
Hughie




hughie

Application.Visible = True and focus
 
This works for me as expected:

But the worksheet will always be behind the userform, although you can still
interact with the WS; Excel is designed that way.
You can .Hide the userform if you do not want it visible, but still loaded.


Oh I see. You might expect it but I didn't (arf!). I had put in a
..hide in any case.

thanks for help :)

Hughie



All times are GMT +1. The time now is 07:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com