Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capturing a workstation's display resolution setting

Status
Not open for further replies.

hoialmen

MIS
Dec 10, 2001
53
US
Does anyone know if there is a VBA command that will return the display resolution settings of the workstation it is being run from? I am hoping to write a function that will resize my forms according to the display settings of the user's workstation but need to figure out how to capture the settings first. Any help will be greatly appreciated.

Thanks!

Nate
 
Not a VBA function but an API call

Visual Basic has th efollowing functions
Screen. xxxx

here is some code

Private Sub SetControls()
Dim X As Integer
Dim Y As Integer

X = Screen.TwipsPerPixelX
Y = Screen.TwipsPerPixelY
Select Case X, Y
Case 15, 15
' Resize and move controls.
txtName.Height = 200
txtName.Width = 500
txtName.Move 200, 200
' Add code for other resolutions.

End Sub
-----------
But I don't know how you would call it from Access DougP, MCP
 
Doug,

Thanks for the tip. One additional question; is there a specific reference library you need to be using for this to work? I am getting an error when I conpile your code saying that "TwipsPerPixelX" is not a recognized method.

Thanks again!

Nate
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top