ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Capturing Screen Size Help Needed! (https://www.excelbanter.com/excel-programming/290281-capturing-screen-size-help-needed.html)

Eloy Argueso

Capturing Screen Size Help Needed!
 
Hi

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

Sincerely

Uncapturable

Beto[_3_]

Capturing Screen Size Help Needed!
 
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.


Martyn

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.




Beto[_3_]

Capturing Screen Size Help Needed!
 
Martyn wrote:

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



All times are GMT +1. The time now is 01:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com