Jay
Fri Feb 22 09:03:26 PST 2008
On Fri, 22 Feb 2008 08:02:03 -0800, Anita <Anita @discussions.microsoft.com>
wrote:
>hi ,
>
>i am using Word Object Model to insert line break at selection using below
>statement:
>
>applicationObject.Selection.InsertBreak(ref BreakType)
>
>where BreakType is defined as
>
>object BreakType = MSword.WdBreakType.wdLineBreak;
>
>i get an COMException "Command Not available" whenever the current selection
>is with textBox. (inserted using Insert->TextBox)
>
>is anyone aware of alternate way of doing the same?
>
>Thanks and Regards,
>Anita.
>
If you try this directly in VBA instead of automating Word from outside, the
error that occurs is "Run-time error '4605': This method or property is not
available because the object refers to a text box."
However, this works in VBA and might work for you:
Selection.TypeText Chr(11)
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ:
http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.