Results 1 to 17 of 17

Reset Screen Resolution

Threaded View

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,065

    Reset Screen Resolution

    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
    Last edited by jomili; 04-27-2011 at 04:11 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1