Fullscreen userform - not working for everyone?

behedwin

Active Member
Joined
Dec 10, 2014
Messages
399
Hi

I am using this code to run my userform in fullscreen.
I have 7 ppl using the document and it works for all but 1.

Code:
Sub Fullscreen()
'fullscreen för userform

    Dim lngWinState As XlWindowState

    With Application
        .ScreenUpdating = False
        lngWinState = .WindowState
        .WindowState = xlMaximized
        Personalform.Move 0, 0, .Width, .Height
        .WindowState = lngWinState
        .ScreenUpdating = True
    End With
End Sub

For everyone it works fine, the userform is stretched to fit the users screen.
But for one it is stretched to much and the user cant see some of the objects on the userform because they are outside of the screen.


Why is this?

Is there some method to ensure that a userform is stretched "better" on all screens?
 
Hello Mr. Jaafaer
We have missed you a lot ..
I have tried the code but the userform is the same (I expect it to be fit screen). I am using windows 7 32 Bit and office 2016 32 Bit
We are waiting for you at this link From Here

Hi YasserKhalil ,

Long time no see .. I wasn't aware of your new arabic excel forum. It looks good .. I wish you good luck with it.

As for the code not working for you, do you get a valid hwnd after calling WindowFromAccessibleObject on the userform :

Code:
Call WindowFromAccessibleObject(Me, hwnd)
    [COLOR=#ff0000][B]Debug.Print hwnd[/B][/COLOR]
 
Upvote 0

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Wow, it worked for me too. Just that I have a multi page format and the page did not expand. Howe do I solve this ?
Kelly
Short of using a propper code that expands each and every control in proportion with the userform, you can try zooming the userform at the end.. something along these lines :
Code:
Private Sub UserForm_Initialize()
    Call WindowFromAccessibleObject(Me, hwnd)
    If IsWindow(hwnd) Then
        SetWindowPos hwnd, Application.hwnd, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), 0
    End If
[COLOR=#0000ff][B]    Me.Zoom = 400[/B][/COLOR]
End Sub
 
Last edited:
Upvote 0
Upvote 0
Short of using a propper code that expands each and every control in proportion with the userform, you can try zooming the userform at the end.. something along these lines :
Code:
Private Sub UserForm_Initialize()
    Call WindowFromAccessibleObject(Me, hwnd)
    If IsWindow(hwnd) Then
        SetWindowPos hwnd, Application.hwnd, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), 0
    End If
[COLOR=#0000ff][B]    Me.Zoom = 400[/B][/COLOR]
End Sub

I used
Code:
Me.Zoom = 150

And it worked for my screen. Can the 400 be in percentage? So say 100%?
Regards
Kelly
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

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