Fix Word VBA SetPlaceholderText Type Mismatch with Late Binding
Question details
The user needs to set Word content control placeholder text reliably through late-bound VBA automation.

- Product
- Microsoft Word VBA
- Device & OS
- not provided
- Scenario
- A VBA add-in uses late binding to update placeholder text in documents that may contain more than 2,000 content controls, without requiring version-specific Word references.
- Observed behavior
- Calling SetPlaceholderText with omitted optional arguments can raise run-time error 13, Type mismatch.
Confirm that your VBA code already has a reference to the target Word document and that the document contains the content control you want to update. Check that the control supports placeholder text and that document protection does not prevent the change.
Pass all three SetPlaceholderText arguments explicitly
Use positional arguments to set placeholder text without omitting optional parameters in a late-bound call.
SetPlaceholderText accepts BuildingBlock, Range, and Text arguments in that order. Passing Nothing for the first two and the desired string for the third avoids the late-binding type mismatch described in this scenario.
Open the VBA editor for your add-in or automation project and locate the procedure that calls SetPlaceholderText.
Use your existing Word document object to get the control. For example, if wordDoc already refers to the document, use: Dim cc As Object followed by Set cc = wordDoc.ContentControls(1).
Set a string variable to the desired placeholder, then call the method with all three positional arguments: sPlaceholderText = "Enter text here" followed by cc.SetPlaceholderText Nothing, Nothing, sPlaceholderText.
Run the procedure from the VBA editor and check the target content control in Word. Apply the same call within your existing loop if you need to update multiple controls.

Edit Word Documents with WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for editing Word documents and moving everyday files between office suites. It does not fix Microsoft Word's late-bound VBA error, and macros or content controls should be tested for compatibility before migration.

Frequently Asked Questions
Why does SetPlaceholderText raise a type mismatch with late binding?
Omitting optional arguments in a late-bound call can cause Word to interpret the arguments incorrectly. Pass Nothing for BuildingBlock and Range, followed by the text string: cc.SetPlaceholderText Nothing, Nothing, sPlaceholderText.
Do I need to add a Microsoft Word object library reference?
No. The positional-argument approach can be used with a late-bound content control declared as Object, provided your code already has a valid Word document and control reference.
Can I use this call for thousands of content controls?
Yes. Place the SetPlaceholderText call inside your existing ContentControls loop and pass all three arguments for each applicable control. Test the control types in your documents first.
Can I clear Range.Text instead of calling SetPlaceholderText?
Setting Range.Text to vbNullString may redisplay the placeholder for some text, date, and combo-box controls, but behavior varies by control type. It can also display spaces instead of the intended placeholder, so use SetPlaceholderText when you need to set the placeholder explicitly.




