![]() |
Option Compare Text
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 |
Option Compare Text
Hi
maybe something like If LCase(activeworkbook.name) = "template" then 'do something end if -- Regards Frank Kabel Frankfurt, Germany Graham wrote: 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 |
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 |
All times are GMT +1. The time now is 12:13 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com