适用于Mac的Word 2016 vba加载项 [英] Word 2016 vba add-in for Mac

查看:112
本文介绍了适用于Mac的Word 2016 vba加载项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为Word创建了一个插件,该插件通过使用Visual Studio用C#编写的api与第三方cmd程序进行通信.使用stdin和stdout进行通信.该程序适用于Windows的Word 2007、2010、2013、2016.

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.

我也已成功将其移植到Mac的Word 2011.此处的api是使用xcode用c编写的,但仍使用stdin和stdout.Mac上的api是一个dylib,我可以在Visual Basic编辑器中引用它.我在Mac版Office 2016上复制此文件时遇到麻烦.我怀疑由于新的安全限制,可能无法实现.当我尝试引用文件时,只能选择.tlb文件(类型库).我只在Windows上使用Visual Studio创建了tlb文件,却不知道在Mac上怎么做.

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.

任何人都可以回答我想做的事是否甚至可以在2016版的Office for 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?

仅供参考:该加载项称为WordMat:www.eduap.com

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

其他信息,以下来自@erik的信息我在声明lib中的函数时遇到了麻烦.这是我的声明语句:将PtrSafe函数声明为VBstrlen Lib"/Library/Application Support/Microsoft/Office365/User Content.localized/Add-Ins.localized/libMaximaConnection.dylib"(作为字符串的ByVal s)作为LongPtr

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

该函数是一个简单的测试函数,它返回字符串的长度.使用上述路径,declare函数可以在Word 2011中按预期工作.

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.

报告的错误是找不到错误53文件

该dylib是32位编译的,因此自Office 2016的64位升级以来,我不希望它起作用,但我希望找不到错误453 DLL ,因为Word 2011会报告.

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.

推荐答案

Office 2016 是沙盒的,只有有限的权限来读取位于特定位置的文件.我撰写了有关为Mac Office 2016安装用户内容的文档,您可以从以下内容开始: http://macadmins.software/docs/UserContentIn2016.pdf

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

特别是,如果为每个特定用户安装了Dylib,则它们必须位于〜/Library/Group Containers/UBF8T346G9.Office/User Content.localized/Add-Ins.localized/中,或者位于/Library/Application Support/Microsoft中/Office365/User Content.localized/Add-Ins.localized/(如果已在计算机上安装一次,供所有用户共享).

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应用程序无法再读取任意文件位置.

Office 2016 apps cannot read arbitrary file locations anymore.

另外,当您尝试添加文件引用时无法选择任何非typelib文件可能是一个错误.我得看看.

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)

这篇关于适用于Mac的Word 2016 vba加载项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆