How to "match" partial file name

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)
 
G

Guest

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top