View Single Post
  #2   Report Post  
Posted to microsoft.public.word.newusers
Cindy M -WordMVP- Cindy M  -WordMVP- is offline
external usenet poster
 
Posts: 370
Default Macro to Paste Same Item a Specific Number of Times?

Hi Kn,

I have 4 paragraphs with specific wording. I would like to prompt the
user for the number of times they wish to copy and paste Paragraph 1,
Paragraph 2, etc. and then have the macro select, copy, and paste each
paragraph the specified number of times. I know I could manually copy
each paragraph to the clipboard and select each paragraph every time I
want to use that particular paragraph, but I'd like to find a more
elegant way to do this.

Well, the basic way to get something to happen "n" times is:

For i = 1 to CLng(InputBox("How many times to repeat?))
'Put the code to repeat here
Next

Note that, as it stands, this isn't full-proof. It will fail if someone
doesn't type a number, for example. If you need more help with this, you
should ask in the word.vba.beginners newsgroup. This group is more for
end-user questions :-9

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :-)