我想在Word for Mac 2011(我坚持使用)中创建的.docx文件中显示代码片段(在R中创建).我试过插入文本框但它们只显示一页的长度,这使编辑变得困难.有什么建议?
PS我意识到之前有关MS Word的一个类似的问题,但没有一个解决方案似乎适用于Mac 2011.
我正在尝试移植我们在Windows上使用MS Word工作的宏,该宏使用网站生成方程图像并返回该图像以插入到文档中.当前(在Windows上工作)调用如下.当我在OSX中使用相同的调用时,我收到错误429,指出"ActiveX组件无法创建对象".
' Create an xmlhttp object.
Set w_page = CreateObject("Microsoft.XMLHTTP")
' Open the connection to the remote server.
w_page.Open "POST", WebAdd, False
' Indicate that the body of the request contains form data
w_page.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
' Actually send the request and return the data:
Font_Size = ComboFontSize.Value
w_page.Send "formula=" & Font_Size & "." & Latex_Str
Run Code Online (Sandbox Code Playgroud)
在Set w_page = CreateObject("Microsoft.XMLHTTP")语句上生成错误.我尝试了几种替代方法,例如:
Set w_page = CreateObject("MSXML2.ServerXMLHTTP")
Run Code Online (Sandbox Code Playgroud)
和
Set w_page = CreateObject("WinHttp.WinHttpRequest.5.1")
Run Code Online (Sandbox Code Playgroud)
但是会产生相同的错误.请帮我找到在OSX Word 2011中发送POST的正确方法.
对于任何感兴趣的人,该项目可在GitHub上获得.
非常感谢!
编辑 …
这是在Word for MAC VBA中.我想将Unicode字符从文本框保存到文本文件.例如,这个字符"⅛".
我用这个代码.
Dim N as Long
N = FreeFile
Dim strText as String
strText = Textbox1.Text 'This is what is in the textbox "?"
Open <file path> For Output As N
Print #N, strText
Close N
Run Code Online (Sandbox Code Playgroud)
它不保存Unicode字符.我知道我必须改变文本编码格式.我怎么做?
同样,如何使用Unicode格式读取文本文件?