+ Reply to Thread
Results 1 to 4 of 4

Application.width <> Userform.width with dual monitors?

  1. #1
    Forum Contributor
    Join Date
    10-10-2018
    Location
    Calgary, Canada
    MS-Off Ver
    2016
    Posts
    214

    Application.width <> Userform.width with dual monitors?

    I have a userform that is the same width of the excel window which is maximized. I have dual monitors.

    Currently the Application.Left is -1445 when excel opens in the left screen, so the screen on the left seems to be in the negative number.

    I set userform.left = application.left, and userform.width = application.width, but even though I cannot see the excel window in the right screen, I can see the right tip of my userform in the right screen. I placed some buttons on the right-most of the user form, so the fact that the tip of the userform is peeking into the right screen means my buttons are not perfectly positioned.

    If I have a single screen, this is easy to fix, because I know if the application.left is a negative number, then part of Excel is "off screen" and I can adjust the width of the userform by the negative number. However, because the application.left takes into account 2 screens: I can no longer determine how far to shorten the userform.

    Does anyone have a solution to this? How do I ensure that no part of the userform is peeking into the right monitor? Thanks!

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,230

    Re: Application.width <> Userform.width with dual monitors?

    Play around with this...
    Please Login or Register  to view this content.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Forum Contributor
    Join Date
    10-10-2018
    Location
    Calgary, Canada
    MS-Off Ver
    2016
    Posts
    214

    Re: Application.width <> Userform.width with dual monitors?

    It doesn't work.

    My makeshift solution is to always assume that when using a single screen with a maximized excel window, that the .left will always be a negative number about -5 or less (and never 0 or more). When I was writing the code with a single screen, this always seemed to be the case. Therefore, always reduce the width by an arbitrary 5 points.

    Q: has anyone encountered a case where the .left (when Excel is maximized) is not a negative 5 or more? Thanks!

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,230

    Re: Application.width <> Userform.width with dual monitors?

    It doesn't work
    Works for me...I have dual monitors...

    What does it not do...

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Let dropdown list width expand beyond width of column so people can read answer choices?
    By xdrenched in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 11-15-2023, 02:05 AM
  2. Center UserForm - Dual Monitors
    By tmleynek in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-04-2016, 02:45 PM
  3. Reconciling units: Column width and image width
    By MarmaladeLover in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-13-2015, 03:03 PM
  4. [SOLVED] Dual Monitors and exact Userform position in the Active window
    By 55horses in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-03-2015, 11:22 AM
  5. Replies: 2
    Last Post: 07-30-2014, 11:13 AM
  6. Application.Width = 75% of Stated Screen Resolution. What is causing this?
    By SymphonyTomorrow in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-30-2014, 01:38 PM
  7. [SOLVED] Set Column Width Based On Total Width Of Other Columns
    By rayneraingoaway in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-28-2006, 06:10 PM

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