ContentControls Added to Word 2016 Documents through Excel 2016 VBA Code…

Russ1701

New Member
Joined
Apr 30, 2003
Messages
17
I can create various ContentControls for Word 2016 using VBA code from within Word.

However, I am creating various Word templates through Excel, using Excel VBA code, based upon data in an Excel file.

When I attempt to create ContentControls in Excel for a Word document (calling ActiveDocument), I get an error:

Compile error:
Method or data member not found

For example, when called from Excel:

Dim objCC As ContentControl

Set objCC = ActiveDocument.ContentControls.Add(wdContentControlRichText)

It errors on “.ContentControls”

If this is caused a missing reference in Excel, what is the appropriate reference to add in addition to the MS Word 16.0 Object Library?

Again, calling strictly from Word, it works fine.

Since this seems to be primarily an Excel issue, I have posted this within the Excel forum.

If there is another possible cause, any guidance would be appreciated.

Thank you.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Forum statistics

Threads
1,215,106
Messages
6,123,124
Members
449,097
Latest member
mlckr

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top