ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Naming a new Excel workbook in a macro (https://www.excelbanter.com/excel-worksheet-functions/120094-naming-new-excel-workbook-macro.html)

GLS

Naming a new Excel workbook in a macro
 
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

Dave Peterson

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




GLS wrote:

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


--

Dave Peterson

GLS

Naming a new Excel workbook in a macro
 
Thanks Dave - that worked great.
--
GLS


"Dave Peterson" wrote:

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




GLS wrote:

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


--

Dave Peterson



All times are GMT +1. The time now is 11:04 AM.

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