Solved

VBA Excel 2010 - ActiveWorkbook.Name

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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.
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
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 in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

685 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