Mitchel Cohen wrote:
How do I embed a macro inside itself, so that it repeats the action
and doesn't just perform one occurrence?
In other words, I want to add an opening "<" to every occurrence of an
email address on a long list. I've developed a simple macro to do that
for the first occurrence, but then I have to hit "run macro" each time
I want it to continue. How do I get the macro to do this automatically?
Thanx.
Mitchel Cohen
Assume that your macro is called "DoIt()". I could write another macro
Sub DoIt100Times()
Dim i As Integer
For i = 1 To 100
DoIt()
Next
End Sub
You could even ask how many times to do the loop and then run it the
requested number of times. More than likely, however, you want to
iterate over your text and do the loop until everything is finished,
which is more difficult because you need to understand how to check this
in your macro. As a quick solution, I usually do something like the
DoIt100Times, or I keep my Main() macro as the first macro in the
module. I then modify main as follows:
sub Main()
DoIt()
End Sub
In the IDE, the first macro in the current module is run by pressing the
"run icon". I can then keep clicking the run macro button until it is
finished.
--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info: http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]