Group:  Microsoft Word ยป microsoft.public.word.newusers
Thread: Macro to Paste Same Item a Specific Number of Times?

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Macro to Paste Same Item a Specific Number of Times?
"KN" <kathy.nicholson[ at ]gmail.com> 02.08.2006 00:19:30
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. Suggestions?

Thanks,
Kathy

Re: Macro to Paste Same Item a Specific Number of Times?
Cindy M -WordMVP- <C.Meister-C[ at ]hispeed.ch> 02.08.2006 19:55:56
Hi Kn,

[Quoted Text]
> 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 :-)

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net