+ Reply to Thread
Results 1 to 4 of 4

Fit screen resolution to userform

Hybrid View

  1. #1
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Fit screen resolution to userform

    Hello everyone
    I have a code that is put in the userform module and it was working in the past
    I tried to use it but got an error "Invalid procedure call or argument" error '5'
    Here's the code

    Private Sub UserForm_Initialize()
        Dim Zo%
        Dim ZH#, ZW#, AL#, AT#, AH#, AW#
        Dim FH!, FW!
        
        AH = Application.Height
        AW = Application.Width
        AL = Application.Left
        AT = Application.Top
        FH = Height
        FW = Width
        ZH = AH - FH
        ZW = AW - FW
        Zo = Zoom
        
        If ZH < ZW Then Zo = Zo * (AH / FH) Else If ZW < ZH Then Zo = Zo * (AW / FW)
        Move AL, AT, AW, AH
        If Zo <> 100 Then Zoom = Zo
    End Sub
    I'm using Windows 10 64 Bit - Office 2013 64 Bit

    Any idea of that error
    Attached Files Attached Files
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  2. #2
    Registered User
    Join Date
    12-20-2015
    Location
    Israel
    MS-Off Ver
    2013
    Posts
    9

    Re: Fit screen resolution to userform

    instead of move function (thet isn't supported for forms)

    use
    me.top =
    me.left =
    me.width =
    me.height =

  3. #3
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Fit screen resolution to userform

    Thanks a lot
    I could get it now
    Instead of
    Move AL, AT, AW, AH
    I used
        Me.Top = AT
        Me.Left = AL
        Me.Width = AW
        Me.Height = AH
    Thanks a lot for great help
    Thank you very much

  4. #4
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Fit screen resolution to userform

    Thanks for reply
    Can you post the whole code as I didn't get your previous post in proper way ..
    Did you mean that I should replace the Application. with Me. ..???

+ 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] Adjust screen resolution automatically to fit all screen sizes
    By Ace_XL in forum Excel General
    Replies: 2
    Last Post: 06-14-2012, 08:51 AM
  2. Screen Resolution
    By yonyon7 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-22-2007, 12:39 PM
  3. Screen Resolution
    By Jason Zischke in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-20-2006, 11:40 AM
  4. [SOLVED] Screen Resolution
    By Jason Zischke in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-15-2006, 01:40 AM
  5. [SOLVED] Can't get screen resolution
    By StevenS in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-12-2005, 09:10 AM
  6. how to let the userform autosize depending on the screen resolution
    By Pierre via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-02-2005, 06:20 PM
  7. [SOLVED] how to let the userform autosize depending on the screen resolution
    By Pierre via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-02-2005, 06:17 PM
  8. Userform and screen resolution
    By funkymonkUK in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-09-2005, 10:05 AM

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