MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Screen Resolution

  Asked By: Harley    Date: Dec 12    Category: MS Office    Views: 1532

My excel spreadsheet is designed in 1024 x 768 Screen Resolution. Some
of my users use other Screen Resolutions (Higher and Lower).

Please help me with code to firstly detect the current Screen
Resolution, then keep that resolution to reference when going out of the
spreadsheet, to set the original screen resolution. Then change the
screen resolution to 1024 x 768 while using my spreadsheet.



1 Answer Found

Answer #1    Answered By: Lena Moore     Answered On: Dec 12

This bit at the top of a module (the declarations section):

Declare Function GetSystemMetrics Lib "user32" _
(ByVal nIndex As Long) As Long
Public Const SM_CXSCREEN = 0
Public Const SM_CYSCREEN = 1

This bit anywhere in a standard code module:

Sub DisplayVideoInfo()
vidWidth = GetSystemMetrics(SM_CXSCREEN)
vidHeight = GetSystemMetrics(SM_CYSCREEN)
Msg = "The current video mode is: "
Msg = Msg & vidWidth & " X " & vidHeight
MsgBox Msg
End Sub

I don't know how to set the screen  resolution/video mode from vba; I
suspect it's difficult. How about using the above information to set
window sizes, form sizes, zoom levels etc.

Didn't find what you were looking for? Find more on Screen Resolution Or get search suggestion and latest updates.