View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Paul Martin Paul Martin is offline
external usenet poster
 
Posts: 114
Default .CodeModule.Find AND PatternSearch (using Regular Expressions)

For anyone interested, the solution to my problem was:

ThisWorkbook.VBProject.VBComponents("mControl").Co deModule.Find("(Calculate|PrintOut)",
1, 1, -1, -1, True, , True)

This code will return True if "Calculate" OR "PrintOut" is found in
mControl module.

Information about Regular Expression Syntax can be found at:
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/ab0766e1-7037-45ed-aa23-706f58358c0e.asp



Paul Martin wrote:

Hi Bob

Thanks for your reply. It appears to me that your suggested code is a
long-winded way of coding something that Excel VBA already automates.
The Find method has a PatternSearch argument. My problem is that I
don't know the syntax for the pattern search. I've been looking
elsewhere on MSDN (haven't got the answer yet) and I was hoping someone
here knew the syntax.

Regards

Paul