Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
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.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default 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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Screen Size [email protected] Excel Worksheet Functions 0 May 25th 09 08:06 AM
Screen Size ? Robert11[_3_] New Users to Excel 3 March 18th 09 10:43 PM
change font size on screen, but prints in old size lvrcdval Excel Discussion (Misc queries) 2 July 19th 07 02:36 PM
Work sheet size relative to screen size Florida Tom Excel Discussion (Misc queries) 1 April 16th 07 02:22 AM
How to get screen size ? Leo Luk Excel Programming 3 December 8th 03 10:11 PM


All times are GMT +1. The time now is 03:19 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"