Naming a new Excel workbook in a macro

G

GLS

Hi

I work in a hospital and am trying to automate the production of waiting
lists from an Access table, imported into a separate Excel workbook for each
month. I'm stuck on how to name each workbook sequentially within the macro.
The convention will be:

0701Wl.xls for Jan 2007
0702Wl.xls for Feb 2007 etc

Can anyone advise me how to do this please?

Many thanks

GLS
 
D

Dave Peterson

Dim WkbkName as string
dim someDate as date
somedate = dateserial(2007,11,14) 'any day in November
wkbkname = format(somedate, "YYMM") & "W1.xls"
 
G

GLS

Thanks Dave - that worked great.
--
GLS


Dave Peterson said:
Dim WkbkName as string
dim someDate as date
somedate = dateserial(2007,11,14) 'any day in November
wkbkname = format(somedate, "YYMM") & "W1.xls"
 
Top