ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Wildcards in workbook name (https://www.excelbanter.com/excel-programming/366736-wildcards-workbook-name.html)

DCHK

Wildcards in workbook name
 
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


Bob Phillips

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





All times are GMT +1. The time now is 08:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com