WD2000: InsertBreak Statement Inserts Unexpected Carriage Return (212277)



The information in this article applies to:

  • Microsoft Word 2000

This article was previously published under Q212277

SYMPTOMS

When you run a macro that uses the WordBasic.InsertBreak statement following a WordBasic.Insert statement, Word inserts a paragraph mark after the inserted text. This behavior is different from versions of Word earlier than Word 97.

WORKAROUND

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

To work around this problem, add the Type:=0 parameter as in the following example:
Sub InsertBreakExample()
   WordBasic.FileNewDefault
   WordBasic.Insert "This is some text"
   WordBasic.InsertBreak Type:=0
End Sub
				
or use the following Visual Basic for Applications equivalent:
Sub InsertBreakExample()
   Documents.Add
   Selection.TypeText "This is some text"
   Selection.InsertBreak Type:=0
End Sub
				

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

Modification Type:MajorLast Reviewed:6/17/2005
Keywords:kbbug kbdtacode kbpending kbProgramming KB212277