Pausing a macro

D

D Collins

Is there a way to pause a macro and then have it resume--
like a spellcheck command would do, once it finds the
error and then wait for the user to fix the error and
then allow them to continue with their spellcheck?

Thanks,
D.
 
J

Jonathan West

D Collins said:
Is there a way to pause a macro and then have it resume--
like a spellcheck command would do, once it finds the
error and then wait for the user to fix the error and
then allow them to continue with their spellcheck?

Hi D Collins

If you have Word 2000 or later, the equivelent is a modeless UserForm. If
you have a UserForm (maybe called UserForm1) then you can have your macro
call it like this

Sub MyMacro()
UserForm1.Show vbModeless
End Sub

This displays the UserForm, but you remain able to edit the document while
the form is displayed.
 
D

Dave Neve

Hi

I think I've missed sth here.

I ran the code on a user form with no commands or anything.

But I couldn't access the Word document behind it.

I did notice that in the properties of my userform, there was 'show modal' =
true.

I kind of imagined that the code would change this property to =false

Any pointers please?

Thanks
 
D

D Collins

I understand this, and it works great, but I have two
questions regarding this:
Let's say it finds the word I'm looking for and I replace
it manually in the background, then how do I resume the
search mode? Also, how can I keep a counter on how many
replacements I made?

Do I use a loop such as For each para in
activedocument.paragraphs?

In other words, I need it to stop executing code once the
first one is found and then resume where it left off--
much like spellcheck.

Thanks, D.
 

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