Wildcards in workbook name

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,

Just a small matter in that I want to select a workbook in order for a macro
in another workbook to collect the necessary variables. The name of the file
will change month on month but will always start with "COM". I guessing that
wildcards will be needed in a code to select a workbook with "COM" in it's
title but can anyone provide tha code? I need this to try and limit as much
as possible user input to run the macro

Many thanks
 
A different approach. When you open the file set that workbook to a workbook
object, and then use that later in the code.

Set myWb = Workbooks.Open("C:\MyTest.xls")

'....

myVar1 = myWB.Worksheets(1).Range("A1")
'etc.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top