Solved

VBA Excel 2010 - ActiveWorkbook.Name

Posted on 2011-09-22
3
321 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 33

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 500 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
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.

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now