ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Skip Run macro if module has been deleted (https://www.excelbanter.com/excel-programming/432004-skip-run-macro-if-module-has-been-deleted.html)

Arran

Skip Run macro if module has been deleted
 
Hi to all,

I have a problem, I have a workbook that has a macro in it that has the
following code:
Else
Run "saveme"
Cancel = True
End If
This works fine but I have another macro that deletes the module that the
"saveme" macro is in.

Is there a way for the above code to be skipped if the module has been
deleted?

Thanks in advance.

slarbie

Skip Run macro if module has been deleted
 
Since trying to run a routine that doesn't exist will trigger an error, why
not just use error handling? i.e.:

On Error Resume Next
Run "SaveMe"
On Error GoTo 0


"Arran" wrote:

Hi to all,

I have a problem, I have a workbook that has a macro in it that has the
following code:
Else
Run "saveme"
Cancel = True
End If
This works fine but I have another macro that deletes the module that the
"saveme" macro is in.

Is there a way for the above code to be skipped if the module has been
deleted?

Thanks in advance.



All times are GMT +1. The time now is 08:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com