Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default GoTo from a form button to a macro

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
--
with kind regards

Spike
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default GoTo from a form button to a macro



"Spike" wrote:

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

--
TimB


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Goto Button Optitron[_6_] Excel Programming 5 September 14th 05 07:48 PM
Attaching a macro to a VB button on a form WildGlio Excel Worksheet Functions 2 March 25th 05 11:11 PM
Pause macro, add form button to sheet, continue macro when button clicked! Flystar[_15_] Excel Programming 1 May 26th 04 09:45 AM
Macro to activate form button kkknie[_90_] Excel Programming 1 May 11th 04 08:31 PM
Goto method fails when assigning a macro to a button Deanne[_2_] Excel Programming 1 August 5th 03 04:36 PM


All times are GMT +1. The time now is 12:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"