• Detect Screen Resolution & Change View % (Excel 2002)

    Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Detect Screen Resolution & Change View % (Excel 2002)

    Author
    Topic
    #410552

    Is it possible to detect a user’s screen resolution and automatically open a sheet with a particular view %. For example, if screen resolution is 600×800, the workbook will adjust the view to 100, if it is 1024X768, it will open under 200% view.

    Viewing 3 reply threads
    Author
    Replies
    • #883175

      Try this piece of code:

      Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
      Public Const SM_CXSCREEN = 0
      Public Const SM_CYSCREEN = 1
      
      'Insert this code to your form:
      
      Private Sub test()
      Dim Tmp As String
      Tmp = GetSystemMetrics(SM_CXSCREEN) & _
      "x" & GetSystemMetrics(SM_CYSCREEN)
      MsgBox (Tmp)
      End Sub
      
    • #883176

      Try this piece of code:

      Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
      Public Const SM_CXSCREEN = 0
      Public Const SM_CYSCREEN = 1
      
      'Insert this code to your form:
      
      Private Sub test()
      Dim Tmp As String
      Tmp = GetSystemMetrics(SM_CXSCREEN) & _
      "x" & GetSystemMetrics(SM_CYSCREEN)
      MsgBox (Tmp)
      End Sub
      
    • #883231

      I often change the view settings within my code. To do this I will select the range I want to be visible on screen and the set the Zoom property of ActiveWindow to True. This then adjusts the zoom % so that all of the selected range is visible on screen. This works fine for me as I mostly work in maximised windows, however, if this code is run in a Normal window it will adjust the zoom settings to suit the window size at that time, if you then maximise the window the zoom will not be at an optimum level.

      I have attached a simple example of how I would use this approach to resize the view for Height, Width and Range.

      Hope this helps,

    • #883232

      I often change the view settings within my code. To do this I will select the range I want to be visible on screen and the set the Zoom property of ActiveWindow to True. This then adjusts the zoom % so that all of the selected range is visible on screen. This works fine for me as I mostly work in maximised windows, however, if this code is run in a Normal window it will adjust the zoom settings to suit the window size at that time, if you then maximise the window the zoom will not be at an optimum level.

      I have attached a simple example of how I would use this approach to resize the view for Height, Width and Range.

      Hope this helps,

    Viewing 3 reply threads
    Reply To: Detect Screen Resolution & Change View % (Excel 2002)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: