+ Reply to Thread
Results 1 to 8 of 8

Using Userforms with and without a dual screen

Hybrid View

  1. #1
    Forum Contributor FRIEL's Avatar
    Join Date
    03-07-2008
    Location
    Coventry
    MS-Off Ver
    2003 and 2007
    Posts
    266

    Using Userforms with and without a dual screen

    Hi guys

    i have recently started using dual screen on my desktop and have come across a problem

    when i run a userform it always appears in the wrong place.
    usualy it appears dead center of the excel window that executed it.

    now it appears at the top-left or center left of my second screen.
    to counter this i had set the top/left values in properties so that the userform is in a more pleasing position

    but now if somone without dual-screens runs the form appears at the far left of their screen

    surley somone has had this problem before

    i have had a search in the forum but couldnt find anything.
    I dont like to use code i dont understand
    it makes it hard to use in other situations
    so please try to be as clear and patent as possible with me

    Criticism is welcomed

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Using Userforms with and without a dual screen

    hi Friel, would that be helpful:

    StartUpPosition Property

    Returns or sets a value specifying the position of a UserForm when it first appears.

    You can use one of four settings for StartUpPosition:

    Setting Value Description
    Manual 0 No initial setting specified.
    CenterOwner 1 Center on the item to which the UserForm belongs.
    CenterScreen 2 Center on the whole screen.
    WindowsDefault 3 Position in upper-left corner of screen.

    Remarks
    You can set the StartUpPosition property programmatically or from the Properties window.

    Example:
    Private Sub UserForm_Initialize()
    UserForm1.StartUpPosition = 1
    End Sub
    Last edited by watersev; 02-02-2012 at 05:34 AM.

  3. #3
    Forum Contributor FRIEL's Avatar
    Join Date
    03-07-2008
    Location
    Coventry
    MS-Off Ver
    2003 and 2007
    Posts
    266

    Re: Using Userforms with and without a dual screen

    they are the settings i have been playing with

    this is the result

    Manual 0 - top, left of screen 2
    CenterOwner 1 - Center height , left of screen 2
    CenterScreen 2 - Center height , left of screen 2
    WindowsDefault 3 - top, left of screen 2

    This is quite frustrating

  4. #4
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Using Userforms with and without a dual screen

    I'm using dual monitors at work, setting CenterOwner for a userform causes it to show up in the middle of the screen Excel is in regardless which of them is set to main. I've tried same file on a colleague computer with one monitor only, works as expected. My Excel 2003, colleague - Excel 2007.

  5. #5
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Using Userforms with and without a dual screen

    Userform properties Position settings of the tested file:

    Height: 180
    Left 0
    StartUpPosition: 1 - CenterOwner
    Top: 0
    Width: 240

  6. #6
    Forum Contributor FRIEL's Avatar
    Join Date
    03-07-2008
    Location
    Coventry
    MS-Off Ver
    2003 and 2007
    Posts
    266

    Re: Using Userforms with and without a dual screen

    nope i have just copied those settings exactly and it has shown up here
    ufm Pos.jpg

  7. #7
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Using Userforms with and without a dual screen

    try to define it's position in code and check result you get. This should put it to the center as per manual settings in the 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

  8. #8
    Forum Contributor FRIEL's Avatar
    Join Date
    03-07-2008
    Location
    Coventry
    MS-Off Ver
    2003 and 2007
    Posts
    266

    Re: Using Userforms with and without a dual screen

    That works like a Dream

    Thanks!
    this has been doing my headin for a few weeks now

    Rep added

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1