View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
BEEJAY BEEJAY is offline
external usenet poster
 
Posts: 247
Default If, Then, Else Coding Problem

Works like a dream - Thanks so much


"Karim Benabd" wrote:

If you want to test whether the active workbook name start with EM_
then try this:

Sub CheckFileName()
' If File Name Starts with 'EM_', Then Process CALL Not Allowed
' If File Name does NOT start with 'EM_', Then Exit Sub

1 Dim FName As String
FName = ActiveWorkbook.Name
2 If Left(FName, 3) = "EM_" Then
3 Call NotAllowed
4 Else: Exit Sub
5 End If