To make my addin handle all the combinations of Excel 2007 onwards on Mac and Windows, 32-bit and 64-bit, I ended up with this conditional compilation block. The example I use is GetTickCount() but the principle applies to other declarations.
Microsoft say “We expressly DO NOT support external use of Win32 APIs on the Mac, even if we have an implementation of them in the Office frameworks.” If you ever find documentation on these, let me know.
'https://msdn.microsoft.com/en-us/library/office/ee691831(v=office.14).aspx 'Compatibility Between the 32-bit and 64-bit Versions of Office 2010 'Apple has deprecated HFS on the Mac, so Mac Office 2016 no longer uses or supports HFS paths. 'You must use POSIX paths (with "/" as the directory separator) in Mac Office 2016. ' In Macscript, when getting folders or files in Mac Office 2016, ' insert "return posix path of " before "(choose folder..." #If Mac Then #If MAC_OFFICE_VERSION >= 15 Then #If VBA7 Then ' 64-bit Excel 2016 for Mac Declare PtrSafe Function GetTickCount Lib _ "/Applications/Microsoft Excel.app/Contents/Frameworks/MicrosoftOffice.framework/MicrosoftOffice" () As Long #Else ' 32-bit Excel 2016 for Mac Declare Function GetTickCount Lib _ "/Applications/Microsoft Excel.app/Contents/Frameworks/MicrosoftOffice.framework/MicrosoftOffice" () As Long #End If #Else #If VBA7 Then ' does not exist, but why take a chance Declare PtrSafe Function GetTickCount Lib _ "Applications:Microsoft Office 2011:Office:MicrosoftOffice.framework:MicrosoftOffice" () As Long #Else ' 32-bit Excel 2011 for Mac Declare Function GetTickCount Lib _ "Applications:Microsoft Office 2011:Office:MicrosoftOffice.framework:MicrosoftOffice" () As Long #End If #End If #Else #If VBA7 Then ' Excel 2010 or later for Windows Declare PtrSafe Function GetTickCount Lib "kernel32" () As Long #Else ' pre Excel 2010 for Windows Declare Function GetTickCount Lib "kernel32" () As Long #End If #End If
See http://www.rondebruin.nl/mac/ for lots more on Excel for Mac, in particular Macscript code for file and folder dialogs.
For Windows API declarations with the new LongPtr type, see
http://www.jkp-ads.com/articles/apideclarations.asp
My previous posts on Excel for Mac are here:
https://sysmod.wordpress.com/2011/10/21/list-of-mac-excel-2011-differences-from-excel-2011/
https://sysmod.wordpress.com/2011/10/24/more-differences-mainly-vba/
https://sysmod.wordpress.com/2011/10/28/mac-excel-vs-pc-excel/
UPDATE 14-March-2019
Excel VBA is now throwing an error 53 file not found for
“/Applications/Microsoft Excel.app/Contents/Frameworks/MicrosoftOffice.framework/MicrosoftOffice”
So the GetTickCount() function is no longer available, unless any reader has an idea.
Is there a list of declarations by API function for Mac 2011 and 2016 anywhere? There are a few for Windows but have struggled to find one for Macintosh.
I don’t know anything about the Mac API, or even if there is one for VBA to correspond to the Windows API.
tickcount on the mac appears to now lives in
Public Declare PtrSafe Function GetTickCount Lib “/Applications/Microsoft Excel.app/Contents/Frameworks/mso20.framework/mso20” () As Long
vbAdder
Thank you @vbAdder! Is that mso20.framework documented anywhere?