Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default determining resolution of current screen display

Hi, I am trying to determine the users screen resolution because the size of
charts etc, are going to be dependant on this. I have some code but for
some reason it returns 800x600 on my monitor when it should be 1280x1024.
Can anyone shed any light on this one?
Here is the code:

Sub screensize()

Dim strSize As String

With Application.DefaultWebOptions
Select Case .screensize
Case msoScreenSize800x600
strSize = "800x600"
Case msoScreenSize1024x768
strSize = "1024x768"
Case msoScreenSize1280x1024
strSize = "1280x1024"
Case Else
strSize = "1280x1024"
End Select
End With

MsgBox strSize

End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default determining resolution of current screen display

Hi Graham,

Try something like

'=============
Option Explicit

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

'---------------

Function DisplayVideoResolution() As String
DisplayVideoResolution = GetSystemMetrics32(0) & " x " & _
GetSystemMetrics32(1)
End Function

'---------------

Sub TestIt()
MsgBox DisplayVideoResolution
End Sub
'=============


---
Regards,
Norman



"Graham Whitehead" wrote in message
...
Hi, I am trying to determine the users screen resolution because the size
of charts etc, are going to be dependant on this. I have some code but
for some reason it returns 800x600 on my monitor when it should be
1280x1024. Can anyone shed any light on this one?
Here is the code:

Sub screensize()

Dim strSize As String

With Application.DefaultWebOptions
Select Case .screensize
Case msoScreenSize800x600
strSize = "800x600"
Case msoScreenSize1024x768
strSize = "1024x768"
Case msoScreenSize1280x1024
strSize = "1280x1024"
Case Else
strSize = "1280x1024"
End Select
End With

MsgBox strSize

End Sub




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default determining resolution of current screen display

Graham,
It looks like that property only applies to HTML output and is a
"suggestion" of what you should aim for, not what the current resolution
actually is.
So:
Private Declare Function GetSystemMetrics32 Lib "User32" _
Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long

Private Sub CommandButton1_Click()
Dim w As Long, h As Long
w = GetSystemMetrics32(0) ' width in points
h = GetSystemMetrics32(1) ' height in points
MsgBox Format(w, "#,##0") & " x " & Format(h, "#,##0"), _
vbInformation, "Monitor Size (width x height)"
End Sub

NickHK

"Graham Whitehead" wrote in message
...
Hi, I am trying to determine the users screen resolution because the size

of
charts etc, are going to be dependant on this. I have some code but for
some reason it returns 800x600 on my monitor when it should be 1280x1024.
Can anyone shed any light on this one?
Here is the code:

Sub screensize()

Dim strSize As String

With Application.DefaultWebOptions
Select Case .screensize
Case msoScreenSize800x600
strSize = "800x600"
Case msoScreenSize1024x768
strSize = "1024x768"
Case msoScreenSize1280x1024
strSize = "1280x1024"
Case Else
strSize = "1280x1024"
End Select
End With

MsgBox strSize

End Sub




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 Resolution Jason Zischke Excel Programming 1 February 20th 06 07:17 AM
Screen Resolution Jason Zischke Excel Programming 2 February 15th 06 05:36 AM
Can't get screen resolution StevenS Excel Programming 3 November 12th 05 01:01 PM
Screen Resolution Ronbo Excel Programming 2 January 17th 05 08:45 PM
Screen resolution Arkimediz Excel Programming 3 April 1st 04 05:23 PM


All times are GMT +1. The time now is 07:20 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"