user27178816
user27178816

Reputation: 1

How do you set a Dim and Set a ContentControl box?

I have a Word doc that has Content Control boxes and Form Fields.

My macro deals with the Form Fields without issue because of:

Dim oMPERFields As FormFields
Set oMPERFields = LogFile.Formfields

The FormField content gets sent to another doc where the data sits in a new report.

But when I try and do the same for the Content Control boxes:

Dim oLogFields As ContentControl
Set oLogFields = LogFile.ContentControl

I get a Object doesn't support this type of method error.

Exactly as above, but so far no result.

The line for moving the CC data to the CC data in the other form is:

oLogFields ("Test").Result = ThisDocument.SelectContentControlByTitle("Test2")(1).Range.Text

Upvotes: 0

Views: 58

Answers (1)

cyberbrain
cyberbrain

Reputation: 5135

If LogFile is an instance of type Document, the correct collection is ContentControls (plural).

You can check the names of functions, collections and properties when you open the object catalog in the window "Microsoft Visual Basic for Applications" where you also edit source code. Press hotkey F2 to open that window, it is also available via the toolbar or the "View" menu.

Inside the object catalog you can use the search function and get infos for parameters in functions etc.

Upvotes: 0

Related Questions