The wildcards does not appear to function in this line of code:
The IF statement never finds a match though I know a workbook with a name containing 'FARF' is open.![]()
If wbBook.Name = "*FARF*.xlsm" Then
The wildcards does not appear to function in this line of code:
The IF statement never finds a match though I know a workbook with a name containing 'FARF' is open.![]()
If wbBook.Name = "*FARF*.xlsm" Then
Last edited by Cutter; 07-18-2012 at 08:25 PM. Reason: Added code tags
= operator doesn't recognise wild cards, so use Like operator.
![]()
If wbBook.Name Like "*FARF*.xlsm"
Hello garygomes,
Welcome to the Forum!
In VBA, the wild cards must be used with the LIKE operator. However, the LIKE operator is case sensitive. Your code will work if written as below and the name is in all capitals.
![]()
If wbBook.Name Like "*FARF*.xlsm" Then
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
you guys rock! Thanks!
Hello garygomes,
You're welcome. Are in the Union City across from the Haystack?
@garygomes
Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself.
Thanks.
Also as a new (or relatively new) poster in the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks