Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VBA Excel 2010 - ActiveWorkbook.Name

Posted on 2011-09-22
3
Medium Priority
?
541 Views
Last Modified: 2012-05-12
Dear Experts,

Could you please advise how to write a check in VBA, which would analyse the active workbook name whether the file name contains characters "OVD"?

So for example if the file name is "OVD_0922.xlsx" in that case the answer is True, if "Book1.xls" in that case False.

thanks,
0
Comment
Question by:csehz
3 Comments
 
LVL 35

Expert Comment

by:Norie
ID: 36579938
Something like this perhaps.

If ActiveWorkbook.Name Like "*OVD*" Then
   MsgBox "The active workbook had OVD in it's name
End If

0
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 2000 total points
ID: 36579949
Msgbox Instr(1, activeworkbook.name, "OVD", vbtextcompare) > 0

Open in new window

for example.
0
 
LVL 1

Author Closing Comment

by:csehz
ID: 36579960
Thanks it works
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question