Capturing Screen Size Help Needed!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

How can I capture the screen size/resolution the monitor is set to from an excel macro

Sincerely

Uncapturable
 
Eloy said:
How can I capture the screen size/resolution the monitor is set to from an excel macro?

You'll need to use an api call, someone once sent me this piece of code
that belongs to John Walkenbach:

Declare Function GetSystemMetrics Lib "user32" _
(ByVal nIndex As Long) As Long
Public Const SM_CXSCREEN = 0
Public Const SM_CYSCREEN = 1

Sub DisplayVideoInfo()
vidWidth = GetSystemMetrics(SM_CXSCREEN)
vidHeight = GetSystemMetrics(SM_CYSCREEN)
Msg = "The current video mode is: "
Msg = Msg & vidWidth & " X " & vidHeight
MsgBox Msg
End Sub

I tried it and it works.
Regards,
 
How come?
It Doesn't accepts SM_CXSCREEN and SM_CYSREEN as public members of objects
on my XL2K.
 
Martyn said:
How come?
It Doesn't accepts SM_CXSCREEN and SM_CYSREEN as public members of objects
on my XL2K.

I don't know. I just opened up a new workbook, created a new VBA module
and copy-pasted the code from this thread. It worked without any
trouble. I'm using Excel2002, but I think it shouldn't be different with
Excel2000. Anyone else with Excel2000 having this problem???

Regards,
 
Back
Top