Start_screen display resolution problem

bsutton19

New Member
Joined
Apr 5, 2006
Messages
24
Hello,

I have a start_screen that has a .jpg for a background, with text boxes and buttons on top. When the spreadsheet is opened on machines with a higher display resolution, the text box and buttons move in relation to the background.

Is there any way that I can keep them in position regardless of display resolution?

Thanks.

Brian
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

bsutton19

New Member
Joined
Apr 5, 2006
Messages
24
Thanks for trying

Erik,

Thanks for the link, unfortunately it didn't help. Anyone else have an idea how to keep the start screen buttons from shifting at different display resolutions?

Brian
 

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
Brian,

feel free to email the file or something similar to me
see emailbutton at bottom of my posts

best regards,
Erik
 

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832

ADVERTISEMENT

your file arrived

you didn't tell the "startscreen" is a userform
I don't see any reason why those buttons move and cannot reproduce the problem. (Office XP, Windows 98SE)
Are you working on a PC or Mac ?

best regards,
Erik
 

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
perhaps:

you made every effort to remove the closing "x" on the form
when deleting that part of the code, do you still have the problem ?

the screenshot you posted shows me that not only the buttons are moving but the "userform-background-picture" is resized, or isn't it ?
 

Joe Was

MrExcel MVP
Joined
Feb 19, 2002
Messages
7,539
Warn the user that the application needs to be viewed at a set resolution, like many games do!

Put code that re-sizes the screen, call it from the ThisWorkbook Open Event. Then in the Before Close Event put it back the way the user had.

This is the basic code to work with the resolution on a Windows PC. [It works on all the versions I have tested it on, up to xp Pro.]


'This must be the first line in a Standard Module, like: Module1!
Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Public Const SM_CXSCREEN = 0
Public Const SM_CYSCREEN = 1
'This must be the fifth line in a Standard Module, like: Module1!
Public myScrHight&

Sub ChScreenSize()
'Ask user to change Resolution.
'Supply Display Utility to change resolution!
Dim myMsg$, iWillConfr%

myMsg = myMsg & "This screen is best viewed at 1024 x 768." & vbCrLf
myMsg = myMsg & "Would you like to change the resolution?"
iWillConfr = MsgBox(myMsg, vbExclamation + vbYesNo, "Screen Resolution")

If iWillConfr = vbYes Then
'Change screen settings
Call Shell("rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,3")
End If
End Sub

Sub ShowMyRes()
'Show current resolution!
Dim myWidth&, myHight&, myCode&, myRes$, myFlag As Boolean

myWidth = GetSystemMetrics(SM_CXSCREEN)
myHight = GetSystemMetrics(SM_CYSCREEN)
myCode = (myWidth * myHight)

Select Case myCode
Case 204544
myRes = myWidth & " x " & myHight '[544 x 376]
Case 307200
myRes = myWidth & " x " & myHight '[640 x 480]
Case 368640
myRes = myWidth & " x " & myHight '[720 x 512]
Case 480000
myRes = myWidth & " x " & myHight '[800 x 600]
Case 786432
myRes = myWidth & " x " & myHight '[1024 x 768]
Case 1016064
myRes = myWidth & " x " & myHight '[1152 x 882]
Case 1036800
myRes = myWidth & " x " & myHight '[1152 x 900]
Case 1310720
myRes = myWidth & " x " & myHight '[1280 x 1024]
Case 1920000
myRes = myWidth & " x " & myHight '[1600 x 1200]
Case 2304000
myRes = myWidth & " x " & myHight '[1920 x 1200]
Case 2592000
myRes = myWidth & " x " & myHight '[1800 x 1440]
Case Else
myRes = "A custom or non-standard resolution of:" & _
vbCr & vbCr & " Size: " & _
myWidth & " x " & myHight
myFlag = True
End Select

If myFlag = False Then
MsgBox "The current system screen resolution is:" & vbCr & _
"A standard screen resolution of:" & vbCr & vbCr & _
" Size: " & myRes & vbCr & vbCr & _
"Psudo-Code: " & myCode
ElseIf myFlag = True Then
MsgBox "The current system screen resolution is: " & vbCr & _
myRes & vbCr & vbCr & "Psudo-Code: " & myCode
End If
End Sub

Sub TestReSetScrSize()
'Automatically reset screen resolution!
Dim xWide&, yHigh&, myMsg$, iWillConfr%, myCode&

xWide = GetSystemMetrics(SM_CXSCREEN)
yHigh = GetSystemMetrics(SM_CYSCREEN)

'Optional exact screen resolution test!
'If ((xWide < 1024 And yHigh < 768) Or (xWide > 1024 And yHigh > 768)) Then
myMsg = "Current screen size is " & xWide & " x " & yHigh & vbCrLf
myMsg = myMsg & "This screen is best viewed at 1024 x 768." & vbCrLf
myMsg = myMsg & "Would you like to change the resolution?"
iWillConfr = MsgBox(myMsg, vbExclamation + vbYesNo, "Screen Resolution")

If iWillConfr = vbYes Then
'Change screen settings
Call Shell("rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,3")
End If
'End If

xWide = GetSystemMetrics(SM_CXSCREEN)
yHigh = GetSystemMetrics(SM_CYSCREEN)
myCode = (xWide * yHigh)

Select Case myCode
Case 480000
Application.DefaultWebOptions.ScreenSize = msoScreenSize800x600 '[800 x 600]
Case Else
Application.DefaultWebOptions.ScreenSize = msoScreenSize1024x6768 '[1024 x 768]
End Select
End Sub
 

Forum statistics

Threads
1,141,728
Messages
5,708,134
Members
421,548
Latest member
douae

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top