get screen resolution

  • Thread starter Thread starter Craig
  • Start date Start date
C

Craig

I would like to be able to position my forms and adjust the zoom in relation
to the users screen resolution. I've seen several visual basic code samples
that get the dimensions of the windows desktop in order to calculate the
screen size but none work with VBA. Is it possible within the limitations of
Excel (2002)?
 
Craig,

You can use the GetSystemMetrics API function to return the
screen size.


Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As
Long) As Long

Sub AAA()
Debug.Print GetSystemMetrics(0&)
Debug.Print GetSystemMetrics(1&)
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Thanks!! It was so easy and simple.


Chip Pearson said:
Craig,

You can use the GetSystemMetrics API function to return the
screen size.


Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As
Long) As Long

Sub AAA()
Debug.Print GetSystemMetrics(0&)
Debug.Print GetSystemMetrics(1&)
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Back
Top