I want to give my users the option to reset their screen resolution when they open my application, and also the option to change it back when they're done. I've got the first part working just fine, but my problem is trying to set up for the change back. My macro is below. The two commented lines are what I'm having problems with right now. What I want them to do is put the values for X and Y in Sheet3, but I can't seem to get them to cooperate. I know it's simple, but I'm stuck. Please help.
Thanks,
John
Sub VerifyScreenResolution(Optional Dummy As Integer)
Dim x As Long
Dim y As Long
Dim MyMessage As String
Dim MyResponse As VbMsgBoxResult
x = GetSystemMetrics(SM_CXSCREEN)
y = GetSystemMetrics(SM_CYSCREEN)
If x = 1361 And y = 768 Then
Else
MyMessage = "Your current screen resolution is " & x & " X " & y & vbCrLf & "This program " & _
"was designed to run with a screen resolution of 1360 X 768 and may not function properly " & _
"with your current settings." & vbCrLf & "Would you like to change your screen resolution now (you can change it back later, if you wish)?"
MyResponse = MsgBox(MyMessage, vbExclamation + vbYesNo, "Screen Resolution")
End If
If MyResponse = vbYes Then
' These lines are not working. They throw a error 13 Type Mismatch
'Sheets(Sheet3).Range("A1").FormulaR1C1 = x
'Sheets(Sheet3).Range("A2").FormulaR1C1 = y
Call Shell("rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,3")
End If
End Sub
Bookmarks