+ Reply to Thread
Results 1 to 2 of 2

How to check Monitor dimensions on a Mac?

  1. #1
    Registered User
    Join Date
    05-10-2015
    Location
    France
    MS-Off Ver
    10
    Posts
    58

    How to check Monitor dimensions on a Mac?

    hello,
    I have a game on Excel. I wanted to give it to my neighbour having a Mac. And big surprise, it does not work!!!
    - 1st error detected is the Monitor dimensions. Of course "winmgmts:" does not work on Mac. What is it on a Mac?

    - Are the UserForms different on a Mac than under Windows? None get loaded !!! strange.

    Here are below the subs not working on Mac. Is there any value available to determine if the computer is a Mac versus a PC?

    Sub Monitor_Dimensions()
    Dim WMIObject As Object
    Dim WMIResult As Object
    Dim WMIItem As Object
    Set WMIObject = GetObject("winmgmts:\\.\root\WMI")
    Set WMIResult = WMIObject.ExecQuery("Select * From WmiMonitorBasicDisplayParams")

    ' Dim Diagonal As Double, Width As Double, Height As Double, Counter As Integer
    Counter = 1
    For Each WMIItem In WMIResult
    Width = WMIItem.MaxHorizontalImageSize / 2.54
    Height = WMIItem.MaxVerticalImageSize / 2.54
    Diagonal = Sqr((Height ^ 2) + (Width ^ 2))

    MsgBox "Your monitor # " & Counter & " is approximately " & Round(Diagonal, 2) & " inches diagonal"
    Counter = Counter + 1
    Next

    ' Select Case Diagonal ' test width of the screen resolution
    '' adapter le zoom du WorkBook selon le résultat
    ' Case 24: ActiveWindow.Zoom = 120
    ' Case 13: ActiveWindow.Zoom = 95
    ' Case 10: ActiveWindow.Zoom = 68
    '' Case Else
    ' End Select
    End Sub
    '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Sub Adapt_Zoom_to_Monitor_Dimensions()
    ' Check how to do this for Mac!!
    On Error GoTo Example_Error
    ' Select Case Diagonal ' test width of the screen resolution
    'adapter le zoom du WorkBook selon le résultat
    If Diagonal > 24 Then ActiveWindow.Zoom = 120
    If Diagonal > 13 And Diagonal < 24 Then ActiveWindow.Zoom = 95
    If Diagonal < 13 Then ActiveWindow.Zoom = 68
    ' Case Else
    ' End Select
    Exit Sub
    ‘ Example_Error:
    If French = True Then MsgBox "Une erreur est survenue."
    If English = True Then MsgBox "An error occured."
    End Sub
    Attached Files Attached Files

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,705

    Re: How to check Monitor dimensions on a Mac?

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 10-17-2017, 10:36 PM
  2. Trying to monitor backlogs
    By cruyff73 in forum Excel General
    Replies: 1
    Last Post: 06-20-2017, 06:33 AM
  3. [SOLVED] flipping on monitor
    By anilg0001 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-28-2013, 05:19 AM
  4. monitor sub-folder
    By xtree in forum Excel General
    Replies: 0
    Last Post: 11-12-2009, 11:33 AM
  5. monitor folder
    By xtree in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-02-2009, 08:48 PM
  6. 3 dimensions
    By Styvie in forum Excel General
    Replies: 0
    Last Post: 11-29-2007, 07:26 AM
  7. Monitor Changes
    By Tempy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-30-2005, 12:05 PM

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