Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
XL2000 I have a macro which calls a bunch of other macro's in order. Sub DoAll() Application.ScreenUpdating = False Call ImportData Call PasteRelevantImportData Call ConcatonateComments Call SortInitial Call GroupDups Call BestGuessColB Call BestGuessColD Call SortFinal Application.ScreenUpdating = True End Sub Some of the macros contain error handling lines like: If such-and-such Then Exit Sub. So that particular Sub ends, and the DoALL macro calls the next Sub. I need a line of code that will actually stop the DoAll macro, not just the one that is executing at the time. Is this possible? Regards - Dave. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You could use a global boolean to track success of each step
Eg: Dim bStop as boolean Sub DoAll() bStop=False Call ImportData If not bStop then Call PasteRelevantImportData ..... End Sub where bStop might be set in ImportData before the Exit Sub statement. Or switch your subs to functions and test the return values. Tim "Dave" wrote in message ... Hi, XL2000 I have a macro which calls a bunch of other macro's in order. Sub DoAll() Application.ScreenUpdating = False Call ImportData Call PasteRelevantImportData Call ConcatonateComments Call SortInitial Call GroupDups Call BestGuessColB Call BestGuessColD Call SortFinal Application.ScreenUpdating = True End Sub Some of the macros contain error handling lines like: If such-and-such Then Exit Sub. So that particular Sub ends, and the DoALL macro calls the next Sub. I need a line of code that will actually stop the DoAll macro, not just the one that is executing at the time. Is this possible? Regards - Dave. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Dave
You want your Sub to return a result (like successful, something like that). Make it a function, a Sub is nothing but a function returning nothing: Function ImportData() As Boolean 'importing, do stuff, then check If Data.Count 0 then 'or whatever, success, we have data: ImportData = True end if End Function And then in Doall: Sub DoAll() If ImportData = False Then Exit Sub If PasteRelevantImportData = False Then Exit Sub and so on, as needed HTH. Best wishes Harald "Dave" wrote in message ... Hi, XL2000 I have a macro which calls a bunch of other macro's in order. Sub DoAll() Application.ScreenUpdating = False Call ImportData Call PasteRelevantImportData Call ConcatonateComments Call SortInitial Call GroupDups Call BestGuessColB Call BestGuessColD Call SortFinal Application.ScreenUpdating = True End Sub Some of the macros contain error handling lines like: If such-and-such Then Exit Sub. So that particular Sub ends, and the DoALL macro calls the next Sub. I need a line of code that will actually stop the DoAll macro, not just the one that is executing at the time. Is this possible? Regards - Dave. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Harold and Tim,
Thanks for your replies, which sloved my problem. Regards - Dave. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macros cells.EntireRow.Hidden = True and Range.Sort are stopping | Excel Programming | |||
Stopping automatic macros | Excel Programming | |||
Stopping macros running? | Excel Programming | |||
stopping the link of macros in one workbook with every other exce. | Excel Discussion (Misc queries) | |||
stopping the link of macros in one workbook with every other exce. | Excel Discussion (Misc queries) |