View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Option Compare Text

Graham,

If you put 'Option Compare Text' at the very top of the code
module (not the procedure), all text comparisons in that module
will be case-insensitive. Short of that, you can use StrComp to
compare two strings and see if they are equal. E.g.,

If StrComp(ActiveWorkbook.Name, "template", vbTextCompare) = 0
Then
' strings are equal
Else
' strings are not equal
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Graham" wrote in message
...
Hi,

I am trying to perform a certain operation via AutoOpen
that will only run if the workbook name is "template" for
example. If the workbook name is anything else I would
like AutoOpen to ignore the procedure. I have been advised
to use Option Compare Text, but I don't know how! Help
please!

Thanks
Graham