2

I have an created an add-in for Word which communicates with a third party cmd-program via an api I have written in c# using visual studio. The communication takes place using stdin and stdout. The program works for word 2007, 2010, 2013, 2016 for Windows.

I have also successfully ported it to Word 2011 for Mac. The api here is written in c using xcode, but still using stdin and stdout. The api on mac is a dylib, which I can reference in the visual basic editor. I'm having trouble replicating this on the 2016 version of Office for Mac. I'm suspecting it might not be possible, due to new security restrictions. When I try to reference a file I can only choose .tlb files (type libraries). I have only created tlb files using visual studio on Windows and have no idea how you might do that on a mac.

Can anyone answer if what I'm trying to do is even possible on the 2016 version of Office for Mac, and where I might find documentation on how to create files that can be referenced?

FYI: The add-in is called WordMat: www.eduap.com

Additional info following information from @erik below I'm having trouble declaring the functions in my lib. Here is my declare statement: Declare PtrSafe Function VBstrlen Lib "/Library/Application Support/Microsoft/Office365/User Content.localized/Add-Ins.localized/libMaximaConnection.dylib" (ByVal s As String) As LongPtr

The function is a simple test function which returns the length of a string. The declare function works as expected in Word 2011 using the above path.

The error reported is error 53 file cannot be located

The dylib is 32-bit compiled, hence I would not expect it to work since the 64-bit upgrade of Office 2016, but I would expect an error 453 DLL cannot be located as Word 2011 would report.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343

1 Answers1

3

Office 2016 is sandboxed, with limited entitlements to read files that live in specific places. I wrote this document on installing user content for Mac Office 2016 that you can start with: http://macadmins.software/docs/UserContentIn2016.pdf

Specifically, dylibs must be located in ~/Library/Group Containers/UBF8T346G9.Office/User Content.localized/Add-Ins.localized/ if they are installed for each specific user, or in /Library/Application Support/Microsoft/Office365/User Content.localized/Add-Ins.localized/ if they are installed once on the machine for all users to share.

Office 2016 apps cannot read arbitrary file locations anymore.

Separately, the inability to choose any non-typelib file when you try to add file references may be a bug. I'll have to take a look.

Schwieb (Principal Software Engineer, Apple Platform Experiences Group, Microsoft Corporation)

  • Thank you very much. This looks promising. I can choose any file under references, but It will not show up in references. It might work if the file is in the right location. – Mikael Samsøe Sørensen Aug 24 '16 at 06:11
  • Ok I now tried both folder locations without any luck. – Mikael Samsøe Sørensen Aug 27 '16 at 05:27
  • 1
    When I try to select the dylib I simply cannot select it- Its grayed out. The default file extension is a word file which can be changed to tlb or 'any file'. Choosing 'any file' does not help. I double checked the folder names numerous times letter by letter. FYI If I go to a locations where I can choose a word file, and choose 'any file' the word file will also gray-out. Running Yosemite 10.10.4. – Mikael Samsøe Sørensen Aug 27 '16 at 05:33