Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

VBA Excel 2010 - ActiveWorkbook.Name

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

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

838 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