GoTo from a form button to a macro

G

Guest

I have a macro that calls a Form on an error. This form gives the user the
choice of Continueing or Exiting. If the Continue button is selected how do
i get the focus (after unloading the form) to return to a particular part of
the macro; as one would with a GoTo command in a macro. i want to return to
the calling macro but at a different place from where the form is called.

Any advices will be gratefully received.

many thanks
 
G

Guest

Spike said:
I have a macro that calls a Form on an error. This form gives the user the
choice of Continueing or Exiting. If the Continue button is selected how do
i get the focus (after unloading the form) to return to a particular part of
the macro; as one would with a GoTo command in a macro. i want to return to
the calling macro but at a different place from where the form is called.

Any advices will be gratefully received.

Hi Spike,

The cleanest way to do this would be to have a seperate Sub for the macro at
the new entry point. For example, if you wanted to skip a chunk of code, you
would work along the lines below:

Old code:
DoSomeStuff
If error then displaycontinueform
DoSomeOtherStuff
DoEvenMoreStuff

New code:
Do some stuff
If error then displaycontinueform
If UserClicksContinue then RunFromThisPoint
DoSomeOtherStuff
RunFromThisPoint

Sub RunFromThisPoint
DoEvenMoreStuff
End Sub

I hope this helps
 

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