View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default Determine if Sub Exists

Just add an error handler:

Sub test()

On Error GoTo ERROROUT

Application.Run "xxx"

Exit Sub

ERROROUT:
MsgBox Err.Description 'or do whatever is suitable

End Sub


RBS


"Paige" wrote in message
...
Is there a way to determine if a sub exists? I have code in an add-in
that
calls a sub in the active workbook per the example below. How do I
determine
if that sub exists in the activeworkbook or not, to avoid an error?

WBName = ActiveWorkbook.Name
Application.Run "'" & WBName & "'!RemoveSN"