View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Sprinks Sprinks is offline
external usenet poster
 
Posts: 86
Default Testing for Valid Macro Name

Chip,

Thank you for your response.

I'm afraid I don't understand your code, but in any case, it returns True
whether the string is a valid name or not.

??

Sprinks

"Chip Pearson" wrote:

Try a function like


Function IsValidProcName(ProcName As String) As String
' reference to "Microsoft VBScript Regular Expressions 5.5
Dim Pattern As String
Dim RExp As VBScript_RegExp_55.RegExp

Set RExp = New VBScript_RegExp_55.RegExp
Pattern = "^[A-Za-z]+[A-Za-z0-9_]*$"
RExp.Pattern = Pattern

IsValidProcName = RExp.Test(ProcName)
End Function



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)

"Sprinks" wrote in message
...
Can anyone tell me how to test if a given string is a valid macro name?

Thank you.

Sprinks