![]() |
Screen Area
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. |
Screen Area
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) www.rondebruin.nl "Tony M" wrote in message ... 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. |
Screen Area
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) www.rondebruin.nl "Tony M" wrote in message ... 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. . |
All times are GMT +1. The time now is 04:14 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com