Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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)

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default How to "match" partial file name

Ardus:
I'll repost, since I have some related issues.

"BEEJAY" wrote:

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?


"Ardus Petus" wrote:

if left(FName,3) = "EM_" then
call NotAllowed
--
AP

"BEEJAY" a écrit dans le message de news:
...
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)




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting "Save As" adds "Copy of" to file name- MS Excel 2007 ronhansen Excel Discussion (Misc queries) 1 November 15th 09 09:33 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Lost "File Menu" - now it's "Edit / View / Insert.." but no "F daves Excel Discussion (Misc queries) 3 April 24th 07 04:52 AM
How to replace "#N/A" w "0"when vlookup couldn't find the match? Holly Excel Discussion (Misc queries) 2 July 17th 06 11:48 PM
Problem- Recording macros for "file save" and "File open" tritaco Excel Programming 1 April 22nd 04 06:15 PM


All times are GMT +1. The time now is 07:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"