» Determine the screen size using VBA in Microsoft Excel
VBA macro tip contributed by Erlandsen Data Consulting offering Microsoft Excel Application development, template customization, support and training solutions
CATEGORY - General Topics in VBA
VERSION - All Microsoft Excel Versions
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
Book Store:
Recommended Books:
- VBA for Modelers: Developing Decision Support Systems Using Microsoft« Excel
- Special Edition Using Microsoft Access 2002
- Essentials of Accounting and Post Test Booklet 8, Eighth Edition
- Financial Statements: A Step-By-Step Guide to Understanding and Creating Financial Reports
- The South Beach Diet: The Delicious, Doctor-Designed, Foolproof Plan for Fast and Healthy Weight Loss
- Financial Peace: Revisited
No comments have been submitted.

