+ Reply to Thread
Results 1 to 3 of 3

Set Userform to Monitor Resolution

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-24-2005
    Location
    Wisconsin
    MS-Off Ver
    2007
    Posts
    378

    Set Userform to Monitor Resolution

    Is it reasonable, or possible, to try to set a userform to size it with a different screen resolution?

    We have a few systems that are set to a screen resolution of 800 x 600 and I usualy try to set to that resolution for any userforms or setting individual sheet zoom resolution.

    For individual sheet resolution I frequently use something like:
    Dim bYesNo As Boolean
        ' use some tool to only do this one time per session, e.g Workbook_Open
        Range("A1:O33").Select
        ActiveWindow.Zoom = True
        Range("A1").Select
        bYesNo = ActiveWindow.Zoom > 100
        If bYesNo Then ActiveWindow.Zoom = 100
    However, this does nothing for the userform. If a user opens the workbook with a screen resolution of 1024 x 768 or even greater the userform starts to look rather small.

    Is there a way to detect what the screen resolution might be, set som constants accordingly and change the individual sheet zoom as well as the userform sizing?

    If so, where can I find examples?
    Thanks!
    Dennis

    I am using Windows 7 and Office 2007, all of my posts are based on this.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Dennis,

    To short answers your questions, yes, it is possible, and no it isn't reasonable. I ran into this same problem a few years ago with a program I wrote. When a UserForm is created, it is scaled automatically to the screen size for the machine on which it is created.

    The screen size and other metrics are easily retrieved by using the API call GetSystemMetrics. Then comes the fun part of rescaling ALL the objects on the resized form. The objects are not too difficult, but the fonts are pain. Because the UserForm is a static window, and not a dynamic one, rescaling is a pain.

    Unlike a regular Window, whose controls themseleves are Windows, a UserForm contains owner drawn windows. These are like the Form's Toolbar controls on a Worksheet. Normal windows are preprogrammed to respond to resizing by rescaling themselves.

    Sincerely,
    Leith Ross

  3. #3
    Forum Contributor
    Join Date
    03-24-2005
    Location
    Wisconsin
    MS-Off Ver
    2007
    Posts
    378

    Thank You for the Short Answers!!

    After I posed my question, I started thinking:
    "If I can scale an individual sheet using the code I had in my earlier message, why bother with a UserForm at all?"

    What I am now attempting to do is set up four individual worksheets that will resemble userforms. By that I mean I am applying a light gray background, using border shading to make things appear to be raised or sunken, right on the sheet, locking and unlocking certain cells, etc, the worksheet range becomes the equivalent of a Userform.

    I am attaching *.jpg docs to show my Spreadsheet Userforms...

    I don't know what terminology you use, but I just had one of those "Eureka" moments. Now I don't have to worry about any scaling except to make the worksheet range change the zoom once a session and my "Userform" now takes up the primary working space of the Excel Window.

    I even think the coding to move data to the database portion will be more simple.

    Simple is way better.
    Last edited by DCSwearingen; 04-11-2008 at 09:55 AM.

+ 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