Hi Jeff,
I was unable to test the routine because I only have Excel 2003 and the ".ExecuteMso" command is not supported in Excel 2003.
However your code will probably fail because when you run "TestMac" there is no return value.
Run "TestMac"
If IsMacOS = False Then CommandBars.ExecuteMso "MinimizeRibbon"
Your code should probably look like this:
Option Explicit
Sub YourRoutineToUseThisCommandOnWindowsOnly()
If IsMacOS = False Then
Application.CommandBars.ExecuteMso "MinimizeRibbon"
End If
End Sub
Function IsMacOS() As Boolean
'This returns 'True' if this is a 'Mac' computer
'This returns 'False' if this is a Windows Computer
'
'Adapted from http://www.rondebruin.nl/mac/mac001.htm (Thank you Rod de Bruin)
#If Win32 Or Win64 Then
IsMacOS = False
#Else
IsMacOS = True
#End If
End Function
Please note that 'Option Explicit' should be at the top of your module and appear only once at the top of each module. To prevent typos from ruining days and weeks of work 'Option Explicit' is NEEDED at the top of each code module. This prevents errors caused by missspellings and FORCES every variable to be DECLARED (e.g. dim i as Integer). http://www.cpearson.com/excel/DeclaringVariables.aspx
Lewis
Bookmarks