PDA

View Full Version : Solved: myContentControl.MultiLine always fails



rruckus
01-23-2012, 01:29 PM
I'm using content controls quite a bit in my Word VBA solution. Sometimes I create Content Controls (CCs) programmatically and want users to be able to type inside of them. The problem is that the users can't type multiple paragraphs inside of my CCs. I am trying to set the .MultiLine property to True so that they can type enter and insert paragraphs but Word always returns:

Automation error
Unspecified error

When I create the CC it is around the whole paragraph, but often it is inside of another CC, which may be part of the problem:

Dim oHeadingCC as ContentControl
Dim oHeadingRng As Range
Set oHeadingRng = Selection.Range.Paragraphs(1).Range
Set oHeadingCC = ActiveDocument.ContentControls.Add(wdContentControlRichText, oHeadingRng)
'13266 - make sure the heading is a para and allows enter key
oHeadingCC.MultiLine = True

It fails on that last line "oHeadingCC.MultiLine = True"

Does anyone know why or how to fix/get around this???

rruckus
01-24-2012, 02:37 PM
I found the answer on my own, you cannot set .MultiLine property on RichText controls! It's a bug in the MSFT documentation.