How to "match" partial file name

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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)
 
Ardus:
I made the adjustments as shown, but I cannot get it to work.
Every time it goes to the "else" statement, even though the active file
does start with "EM_".
What am I overlooking?
 
Back
Top