View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
BEEJAY BEEJAY is offline
external usenet poster
 
Posts: 247
Default How to "match" partial file name

Greetings:
When file is open and special menu item selected, the first thing that
needs to be done is determine if the file name start with "EM_".
If if does, then call up message, "not allowed" and exit
if is doesn't, then continue with process.
Please see my efforts, below

Sub CheckFileName()

' if File Name starts with 'EM_', then process is not allowed.
' When click on OK, exit macro project
' If does NOT start with 'EM_', then Proceed
' Call EMailAnswerC1A

Dim FName As String

If FName = "EM_*" Then
Call NotAllowed
Else: Call EMailAnswerC1A
End If

How (or what) can I use as a wild card, to make this work.
(there is no fixed file name length)