View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Martyn Martyn is offline
external usenet poster
 
Posts: 80
Default Capturing Screen Size Help Needed!

How come?
It Doesn't accepts SM_CXSCREEN and SM_CYSREEN as public members of objects
on my XL2K.


"Beto" wrote in message
...
Eloy Argueso wrote:

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,
--
Beto
Reply: Erase between the dot (inclusive) and the @.
Responder: Borra la frase obvia y el punto previo.