RichardWorth
06-02-2016, 02:13 PM
Hi,
Despite the nay-sayers, the Windows APIs are available in:
Applications:Microsoft Office 2011:Office:MicrosoftOffice.framework:MicrosoftOffice
I used these to write a routine to load a picture into a userform at run time (YES - at runtime). However, I think the sandbox is becoming a problem in Office 2016. The equivalent file for Excel 2016 seems to be in
Applications:Microsoft Excel.app:Contents:Frameworks:MicrosoftOffice.framework:MicrosoftOffice
While I can open this file with VBA the API calls say that this is file is not found even though it exists (and it is in Excel's sandbox area).
For example,
#If Mac Then
#If MAC_OFFICE_VERSION >= 15 Then
'2016 or later
Private Declare Function GetDC Lib "Applications:Microsoft Excel.app:Contents:Frameworks:MicrosoftOffice.framework:MicrosoftOffice" _
(ByVal hWnd As Long) As Long
#Else
'2011
Private Declare Function GetDC Lib "Applications:Microsoft Office 2011:Office:MicrosoftOffice.framework:MicrosoftOffice" _
(ByVal hWnd As Long) As Long
#End If
Calling GetDC in Excel 2011 works fine but in 2016 it says the file is not found.
Is there any way to call DLLs in Office 2016?
If this can be solved, then I'll let everyone have my routine for loading bitmap files in userforms at runtime. In other words, it works fine in Excel 2011, but not Excel 2016.
Thanks,
Richard
PS. I tried the CALL excel 4.0 macro sheet and it didn't work either.
PPS. If it is impossible to call DLLs from Office 2016 for Mac then I will make available my initial workaround for loading pictures into a userform at runtime - modify a frx file and import it - clunky and slow, but it works.
PPPS. If you do try to play around with the Windows APIs do not have anything of value open on your machine. Code which works perfectly in Windows can crash a Mac. Nevertheless, API calls used to read pointsperpixel etc worked fine.
Despite the nay-sayers, the Windows APIs are available in:
Applications:Microsoft Office 2011:Office:MicrosoftOffice.framework:MicrosoftOffice
I used these to write a routine to load a picture into a userform at run time (YES - at runtime). However, I think the sandbox is becoming a problem in Office 2016. The equivalent file for Excel 2016 seems to be in
Applications:Microsoft Excel.app:Contents:Frameworks:MicrosoftOffice.framework:MicrosoftOffice
While I can open this file with VBA the API calls say that this is file is not found even though it exists (and it is in Excel's sandbox area).
For example,
#If Mac Then
#If MAC_OFFICE_VERSION >= 15 Then
'2016 or later
Private Declare Function GetDC Lib "Applications:Microsoft Excel.app:Contents:Frameworks:MicrosoftOffice.framework:MicrosoftOffice" _
(ByVal hWnd As Long) As Long
#Else
'2011
Private Declare Function GetDC Lib "Applications:Microsoft Office 2011:Office:MicrosoftOffice.framework:MicrosoftOffice" _
(ByVal hWnd As Long) As Long
#End If
Calling GetDC in Excel 2011 works fine but in 2016 it says the file is not found.
Is there any way to call DLLs in Office 2016?
If this can be solved, then I'll let everyone have my routine for loading bitmap files in userforms at runtime. In other words, it works fine in Excel 2011, but not Excel 2016.
Thanks,
Richard
PS. I tried the CALL excel 4.0 macro sheet and it didn't work either.
PPS. If it is impossible to call DLLs from Office 2016 for Mac then I will make available my initial workaround for loading pictures into a userform at runtime - modify a frx file and import it - clunky and slow, but it works.
PPPS. If you do try to play around with the Windows APIs do not have anything of value open on your machine. Code which works perfectly in Windows can crash a Mac. Nevertheless, API calls used to read pointsperpixel etc worked fine.