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
Bookmarks