Naming a new Excel workbook in a macro

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

Guest

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
 
Dim WkbkName as string
dim someDate as date
somedate = dateserial(2007,11,14) 'any day in November
wkbkname = format(somedate, "YYMM") & "W1.xls"
 
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"
 
Back
Top