User form goes behind Excel Window When Message Box Pops Up

keromero

New Member
Joined
Feb 20, 2025
Messages
42
Office Version
  1. 2016
I have managed to code a standalone like VBA userform, by the great help of MrExcel professional users assistance and almost done.

it seems Just one issue left to manage.

The user form works such as a standalone application by the help of "Windows.Visible = False" command:

Set xl = Application
ThisWorkbook.Windows(1).Visible = False
If Workbooks.count = 1 Then

xl.Visible = False
Else
xl.Visible = True
End If


As long as the excel sheet fires and the: "Windows.Visible" goes to False mode.

Any message box pops up, shows over userform without an issue.

However in case another excel file (workbook) is opened and screen layering states as follows:

Top: Userform
Behind : Other Excel Workbook's Excel window


And a user-form related message box pops up; then userform goes behind the: "Other Workbook's Excel window". And the screen layering is as follows until message box is closed:

Top: Userform related message box
Middle : Other Workbook's Excel window
Behind: User-Form


How can we ensure all the time: "Other Workbook's Excel window" to stay behind of userform and userform related message box during any user-from related message box popup like follows:

Top: Userform related message box
Middle : User-Form
Behind: Other Workbook's Excel window


Thanks for the help.
 

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