userform screen placement

dinotom

Active Member
Joined
Aug 2, 2009
Messages
357
Is there any way to tell a userform to always open in the center of the excel screen? It always seems to open somewhere in outer space on multiple screen setups.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Thomas

Userforms have a property called StartUpPosition which has the constant 1 - CenterOwner.

It's the default value, and in my experience a userform with that property set to that value opens up in the centre of the window it's being called from.

Mind you I'm not sure what you mean by multiple screen setups.:)
 
Upvote 0
well positions 1 and 2 open the form up in the center of your TOTAL screen space, ie the middle of the space whether its a 1 or 2 or 3 or 4 monitor setup. 0 is for manual start up position. Any idea how to use that so the form opens up on top of the excel workbook instead of somewhere else?
 
Upvote 0
Thomas

Short answer - No.

I've never worked with multiple monitors with Excel, VBA or anything else.:)
 
Upvote 0
Interesting, as I didn't know I had a problem along the same lines, but after reading this post, I realise I do!

I've got a 22" widescreen monitor to the left and a 19" standard to the right

In one particular Workbook, if opened on the left screen, the Userforms open nicely in place over the Workbook. However, if I open Excel on the right screen and run the same Workbook, the Userform still opens on the left monitor!

(I think this might be a driver issue TBH, as if I use PaintShop Pro for example, the toolbars often end up on the wrong screen!)
 
Upvote 0
This sounds very familiar...

I often have the luxury of using 2 or even 3 monitors while developing, one would typically show Excel itself, the other the VBE window (and email or browser on MrExcel on the 3rd :biggrin:)

The userforms however appear either over the Excel window, or over the VBE window, depending from where I start the macro. There also seems to be some memory effect like you describe as well... start a macro on screen 1, userform will show on screen 1, move Excel to screen 2, stop the macro, start the macro again, userform will again open on screen 1...
I have yet to find the system and logic behind it though :confused:

Excel isn't too good with handling multi-monitor setups, I like to use them during developing, afterwards, when using the application without the VBE open, and using only 1 monitor, it usually (;)) goes well...

Sorry I couldn't give any detailed solutions...
 
Upvote 0
The following code will center the userform in Excel's window:

Code:
With UserForm1
  .StartUpPosition = 0
  .Left = Application.Left + (0.5 * Application.Width) - (0.5 * .Width)
  .Top = Application.Top + (0.5 * Application.Height) - (0.5 * .Height)
  .Show
End With</pre>
 
Upvote 1
Unfortunately that code will only work for a one monitor setup. I am seeking a solution for multiple monitor setups
 
Upvote 0
It works for 2 monitors. I use it at work. We all have 2 monitors. The Excel program was displaying in the left monitor and the userform was displaying in the right monitor. After adding the above mentioned code, the Excel program and userform both display in the left monitor.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,329
Members
452,635
Latest member
laura12345

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