Workarounds for gaps in Word for Mac 2011 VBA object model?

帅比萌擦擦* 提交于 2019-11-28 06:28:40

问题


There seem to be a bunch of things in the Word 2007/2010 VBA object model which are simply missing in Word 2011 VBA.

Specifically, Word 2007 (for Windows) includes objects and methods related to:

  • ContentControls
  • CustomXMLParts
  • OpenXML

For example:

**Word.Document**

Property ContentControls As ContentControls
contentcontrol events eg Event ContentControlAfterAdd(NewContentControl As ContentControl, InUndoRedo As Boolean)

Property CustomXMLParts As CustomXMLParts

Property WordOpenXML As String

**Word.ContentControl**

Property XMLMapping As XMLMapping

**Word.ContentControls**

Function Add([Type As WdContentControlType = wdContentControlRichText], [Range]) As ContentControl

**Word.Selection/Word.Range**

Sub InsertXML(XML As String, [Transform])

In the VBA editor in Word 2011, I can't find any of these.

Are the differences between Word 2011 VBA and Word 2010 VBA object models documented anywhere?

I've also browsed/searched the Script Editor's dictionary, to see whether any of these objects are exposed there. They aren't.

In my experiments so far, Word 2011 does preserve existing content controls in a docx (ie it saves them), but you can't see them on the document surface in the UI, and there doesn't seem to be any way to add new ones (either via the Developer tab, or via VBA or AppleScript).

So, any suggestions as to how to work with around gaps in the Word for Mac 2011 VBA object model generally, and in particular how to work with content controls and custom xml in Word on the Mac?


回答1:


Unfortunately it appears that CC work in VBA has been removed from Mac Word 2011 VBA. See this page:

Object Model Changes from Microsoft Word 2010

The full online help for Mac Word 2011 VBA is at: http://mac2.microsoft.com/vb/1033/default.aspx?src=wd



来源:https://stackoverflow.com/questions/4445940/workarounds-for-gaps-in-word-for-mac-2011-vba-object-model

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!