Screen Area

  • Thread starter Thread starter Tony M
  • Start date Start date
T

Tony M

Is there a way to use VBA to retrieve (or set) the user's
screen area eg 800x600, 1024x768 etc.

I am trying to format a file so that when the user opens
it the graphs within it are displayed at almost full
screen, but I don't want to put the charts on individual
Charts sheets.

Many thanks
Tony M.
 
Try this in a normal module
It will change the zoom


Declare Function GetSystemMetrics32 Lib "user32" Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long
Function DisplayVideoResolution() As String
DisplayVideoResolution = GetSystemMetrics32(0) & " x " & GetSystemMetrics32(1)
End Function

Sub test()
If DisplayVideoResolution = "1024 x 768" Then Zoom = 100
If DisplayVideoResolution = "800 x 600" Then Zoom = 80
If DisplayVideoResolution = "640 x 480" Then Zoom = 50

ActiveWindow.Zoom = Zoom
End Sub
 
Thanks Ron, that worked perfectly.

Tony M.
-----Original Message-----
Try this in a normal module
It will change the zoom


Declare Function GetSystemMetrics32 Lib "user32"
Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long
Function DisplayVideoResolution() As String
DisplayVideoResolution = GetSystemMetrics32(0) & " x " & GetSystemMetrics32(1)
End Function

Sub test()
If DisplayVideoResolution = "1024 x 768" Then Zoom = 100
If DisplayVideoResolution = "800 x 600" Then Zoom = 80
If DisplayVideoResolution = "640 x 480" Then Zoom = 50

ActiveWindow.Zoom = Zoom
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)




"Tony M" <[email protected]> wrote in
message news:[email protected]...
 
Back
Top