How to show a second userform in front of the first one shown.

OaklandJim

Well-known Member
Joined
Nov 29, 2018
Messages
855
Office Version
  1. 365
Platform
  1. Windows
I have a somewhat basic UserForm that includes a button that shows a second UserForm. All works well except that the second userform is shown behind the first one when it starts up. How do I tell the second one to be in front to the first one?
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
If the 1st one is modal, I don't think you can. So set ShowModal property of 1st form to no, or in vba, open it that way. For second form, it depends on what you want to do after.
 
Upvote 0
I set up a test like the one you described and I cannot reproduce your results. In my test the second form is on top and has focus.

I have tested all combinations of modal and modeless forms, and calling from standard modules and from within the forms. For all the valid* ones, the second form to be shown is on top and has focus. (*You cannot Show a modal form from a modeless form.)

Can you give us more detail about your setup? If you want I can link to a test file for what I tried.
 
Upvote 0
It's probably better to hide the first form instead of trying to control its z order?
EDIT - if both of my forms have ShowModal set to no the following works, but not if the 1st is set to true

UserForm.Show vbModeless
UserForm3.Show vbModal
 
Upvote 0

Forum statistics

Threads
1,223,950
Messages
6,175,582
Members
452,653
Latest member
craigje92

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top