1

Im working on a project for a VBA program for which the the entire program is to be viewed in maximized/fullscreen view. No Tabs, Formula bars etc. The user will navigate the worksheets with custom buttons and commands. The issue im having is that most of my design is coming from my laptop and (with res 1366/768) and when it is viewed on a bigger monitor (res 2880/1620) the view is not aesthetically pleasing.

Is there a way to code VBA to adjust the view based on the users screen size? Im aware of using range.zoom but that will just cause the images to be absurdly massive on a larger screen even though it would be to scale it would be more pleasing to the eye for the zoom to be set back when the screen gets to a certain size. Even if the process coudn't be automatic. im not opposed an input box opening at the start of the program for the user to select small, medium or large before it runs.

Private Sub Workbook_Open()

    Dim wsh As Worksheet
    Dim CarryOn As Integer
    Set wbPB = PokerBros
    Set wsh = wbPB.Worksheets("Home")

        CarryOn = MsgBox("Do you want to save a copy of this original file?", vbQuestion + vbYesNo, "Save Copy Recommended")
        If CarryOn = vbYes Then
           Call CopyToNewBook
        End If

        wsh.Activate
        Call ZoomToFitHome
        Call ScreenDisplayMax
End Sub

Sub ZoomToFitHome()

    Dim wbh As Worksheet
    Set wbPB = PokerBros
    Set wbh = wbPB.Worksheets("Home")

        wbh.Range("A1:AA30").Select

        ActiveWindow.Zoom = True 'set range zoom

End Sub

Sub ScreenDisplayMax()
'        Call UnProtectAllSheets
        With Application
            .DisplayStatusBar = False
            .DisplayFullScreen = True
            With ActiveWindow
                .WindowState = xlMaximized
                .DisplayHeadings = False
                .DisplayWorkbookTabs = False
                .DisplayGridlines = False
                .DisplayHorizontalScrollBar = True
                .DisplayVerticalScrollBar = True
            End With
            .DisplayFormulaBar = False
        End With
End Sub
braX
  • 11,506
  • 5
  • 20
  • 33

0 Answers0