ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How To Create a Document in Excel from a Template, Using a Macro (https://www.excelbanter.com/excel-programming/339266-how-create-document-excel-template-using-macro.html)

Z Nicodemous

How To Create a Document in Excel from a Template, Using a Macro
 
Hi There,

Well its not QUITE as simple as the subject.....

What i want to do is the following:

I have a template called "Job000"

I created a macro which automatically creates a new document from the
template.

When i run the macro, its creates a document called "Job0001"

When i run the macro again, it again creates a document called "Job0001"

What i want to happen is for it to automatically generate a different
filename each time, specially "Job0002" - "Job0003" - "Job0004" - so on and
so forth.

I can not figure out how to do this, so i am hoping someone can help me.

Many Regards
Zach Nicodemous

NickHK

How To Create a Document in Excel from a Template, Using a Macro
 
Zach,
That is the way that templates work.
To increment the name each time, you would have to store the last number
used somewhere (in the work book creating the new file from the template),
then rename (SaveAs) the new file with "Job" & Format(LastNumber+1,0000),
then update the value of LastNumber ready for next time.

NickHK

"Z Nicodemous" <Z wrote in message
...
Hi There,

Well its not QUITE as simple as the subject.....

What i want to do is the following:

I have a template called "Job000"

I created a macro which automatically creates a new document from the
template.

When i run the macro, its creates a document called "Job0001"

When i run the macro again, it again creates a document called "Job0001"

What i want to happen is for it to automatically generate a different
filename each time, specially "Job0002" - "Job0003" - "Job0004" - so on

and
so forth.

I can not figure out how to do this, so i am hoping someone can help me.

Many Regards
Zach Nicodemous





All times are GMT +1. The time now is 05:12 PM.

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