View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Wildcards in workbook name

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)

"DCHK" wrote in message
...
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