Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, RB and Howard, for both great ideas!
"Howard31" wrote: Actually there is no use for a MsgBox instead use the i variable as follows: If ProcExists("RemoveSN") Then Application.Run "'" & WBName & "'!RemoveSN" Function ProcExists(ProcName As String) As Boolean Dim i On Error Resume Next i = ThisWorkbook.VBProject.VBE.ActiveCodePane.CodeModu le.ProcBodyLine(ProcName, vbext_pk_Proc) If Err.Number < 0 Then ProcExists = False Else ProcExists = True End If End Function -- A. Ch. Eirinberg "Paige" wrote: 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" |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA:: determine if UDF exists? | Excel Discussion (Misc queries) | |||
Determine if a File Exists | Excel Programming | |||
determine if value exists | Excel Programming | |||
Determine if folder exists | Excel Programming |