Screen resolution

A

Arkimediz

I have a 30 sheet Excel package that was designed on a
monitor using 800 x 600 resolution and most sheets
have "Frozen Panes" to hide certain parts. It forces
itself into Full Screen mode for maximum use of the screen.

When it displays on a 1024 x 768 resolution monitor it
shows rows and columns that should be out of sight. I
don't want to use hide rows or columns as that makes
modifying the package more complicated.

Is there a way of detecting the screen resolution and
zooming Excel to only show what it does in 800 x 600
resolution?
 
P

papou

Hi
You can find the screen resolution with an API function:
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As
Long) As Long
Private Const SM_CXSCREEN = 0
Private Const SM_CYSCREEN = 1
Public Function GSR() As String
GSR = CStr(GetSystemMetrics(SM_CXSCREEN)) & " x " &
CStr(GetSystemMetrics(SM_CYSCREEN))
End Function
Sub show()
MsgBox "Current screen resolution is " & GSR, vbInformation
End Sub

HTH
Regards
Pascal
 
D

DennisE

Arkimediz,

Virtually all advanced Excel programming texts explain how to use the
elementary APL GetSystemMetrics call to get the screen resolution. It takes the
form
vidWidth = GetSystemMetrics(SM_CXSCREEN)
[For the height it is
vidHeight = GetSystemMetrics(SM_CYSCREEN)]

Once I have the vidwidth I can then expand my UserForms by multiplying the Zoom
property of my UserForms by the factor vidWidth / 800

In your case you could try multiplying the column widths by the same factor.

-- Dennis Eisen
 
H

Harald Staff

Sub Zoom2Fit()
Columns("A:H").Select
ActiveWindow.Zoom = True
End Sub

HTH. Best wishes Harald
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top