Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.1k views
in Technique[技术] by (71.8m points)

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

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...