Screen Area

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.
 
R

Ron de Bruin

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
 
G

Guest

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]...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top