Word

Add dummy text to your document

Ease of Use

Easy

Version tested with

2000, 2002, 2003 

Submitted by:

MOS MASTER

Description:

This sub will add 10 paragraphs of dummy text to your document. 

Discussion:

Sometimes you need a lot of dummy text to try out a certain procedure. With this method you can add that amount of dummy text that you need. =Rand() is a special thing in Word to add dummy text. This is how it works: =rand(10) creates 10 paragraphs. =rand(10,3) creates 10 paragraphs with 3 sentences in it. =rand(10, 7) creates 10 paragraphs with 7 sentences in it. Read more about it here: http://support.microsoft.com/?kbid=212251 (Read the part about Replace as you type if you experience problem executing this little sub) 

Code:

instructions for use

			

Option Explicit Sub RandomText() ' \\ Change 10 to how many paragraphs of dummy text you like Selection.TypeText Text:="=Rand(10)" ' \\ Press Enter SendKeys "~", True End Sub

How to use:

  1. Open your Word document.
  2. Press Alt + F11 to open VBE.
  3. Insert-Module. (Insert -> module)
  4. Paste the code there in the window at right. (F7)
  5. Close VBE (Alt + Q or press the X in the top right hand corner).
  6. Save the file.
 

Test the code:

  1. From Word, press Alt + F8 to open the macro dialog box.
  2. Select RandomText
  3. Click Run.
 

Sample File:

Dummy Text.zip 5.95KB 

Approved by mdmackillop


This entry has been viewed 128 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express