ERLANDSEN DATA CONSULTING Excel & VBA Tips   Informasjon på norsk / Information in Norwegian

These pages are no longer updated and are only available for archive purposes.

Click here to visit the pages with updated information.

Determine the screen size

With the macro below you can return the screen size with the function GetSystemMetrics32.

Declare Function GetSystemMetrics32 Lib "User32" _
    Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long

Sub DisplayMonitorInfo()
Dim w As Long, h As Long
    w = GetSystemMetrics32(0) ' width in points
    h = GetSystemMetrics32(1) ' height in points
    MsgBox Format(w, "#,##0") & " x " & Format(h, "#,##0"), _
    vbInformation, "Monitor Size (width x height)"
End Sub

 

Document last updated 1999-07-23 12:47:32      Printerfriendly version

User comments:
Miguel Fischman from Buenos Aires, Argentina wrote (2006-04-19 17:17:07 CET):
Thanks a lot!
Thanks a lot for your great site. I learn a lot from it. I hope you get as much work as you want to do.
Ole P. from Norway wrote (2005-03-03 19:50:16 CET):
Re: kocham cię!
Thank you very much :-)
For those of you who isn't fluent in Polish, this means "I love you" according to this online dictionary.
Karolina Pastor from Siedlce wrote (2005-03-03 17:19:26 CET):
zossik@o2.pl
kocham cię!

 

Erlandsen Data Consulting     http://www.erlandsendata.no/   
Excel & VBA Tips   Copyright ©1999-2024    Ole P. Erlandsen   All rights reserved
E-mail Contact Address