n00bAppDev
n00bAppDev

Reputation: 630

Carriage Return in VBscript?

I am writing a script in VBscript and I need to include line breaks or carriage returns. I was using the following code:

objSelection.TypeParagraph()

But this creates to big of a space between lines. The best way I can think to explain it is, when you are in Microsoft word, and you type a line, if you were to press Shift + Enter, you would get two separate lines close together, whereas pressing just Enter will do a full Carriage return (which I don't want). I will demonstrate here.

How can I achieve the same result as 'Shift + Enter' but through VBscript?

Thank you very much.

Upvotes: 1

Views: 6369

Answers (1)

Roger Rowland
Roger Rowland

Reputation: 26279

Assuming you're asking about Word VBA, you can do it like this:

objSelection.TypeText(Chr(11))

Generally, if you can't find out how to do something in VBA that you can do in the application, just record a macro while you perform the required steps and then look and see what VBA has been generated.

Upvotes: 1

Related Questions