View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Testing for Valid Macro Name

You would have to write code to read all the information in the modules and
parse out the macro names.

A start is he

http://www.cpearson.com/excel/vbe.htm

Or you might try something like this:

Sub AAA()
s = "MyMacro"
On Error Resume Next
Application.Run s
If Err.Number < 0 Then
MsgBox s & " is not a macro name or there is an error in the macro"
Else
MsgBox "OK"
End If
On Error goto 0

End Sub

--
Regards,
Tom Ogilvy


"Sprinks" wrote:

Can anyone tell me how to test if a given string is a valid macro name?

Thank you.

Sprinks