Repeating macro

D

Douglas

I am trying to learn how to write macros in Word 2007, and I need to develop
a macro that will repeat a certain task a specified number of times. To
initialize the macro, the user will enter in the number of times the task
will be repeated, so the macro will keep performing the job until the
specified limit has been reached.
 
H

Helmut Weber

Hi Douglas,

;-)

Sub Test6666()
Dim l As Long
On Error GoTo theend
For l = 1 To InputBox("howoften")
MsgBox l 'or your macro
Next
Exit Sub
theend:
MsgBox "damn it"
End Sub

:)



--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 
D

Douglas

Thanks for the help. But now I need to figure out how to create a userform
where I can input the number of times I want the macro to repeat.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top