LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Need your hep: Creating new workbooks and name it based on a l

After seeing the reply by Per Jessen I am now wondering if your template is
actually a normal workbook or a template file. If it is a template file then
Per's answer is what you will want. However, if it is a normal workbook then
try the following.

Create a new workbook and copy the following code.

Note the comments. I have created a variable for both the original workbook
and another for the multiple copies in case you want the copies in a folder
of their own. If both in the one folder then just set them both the same.

Also don't know what version of Excel you are using so have set macro to run
with Excel 97-2003 and have a commented out line of code for Excel 2007 in
case you need that.

Sub MakeMultiCopies()

Dim strTemplatePath As String
Dim strSavePath As String
Dim rngFileList As Range
Dim rngFileName As Range

'Edit following line to match your path for Template file
strTemplatePath = "C:\Users\\Documents\Excel\Template\"

'Edit following line to match your path for saving new workbooks
strSavePath = "C:\Users\\Documents\Excel\Multi Copies\"

With Sheets("Sheet1")
Set rngFileList = .Range(.Cells(1, 1), _
.Cells(.Rows.Count, 1).End(xlUp))
End With

For Each rngFileName In rngFileList

'Edit following to match your Filename.
Workbooks.Open Filename:= _
strTemplatePath & "My Template.xls"

'Use following code to Save in XL97-2003 format
ActiveWorkbook.SaveAs Filename:= _
strSavePath & rngFileName.Value & ".xls", _
FileFormat:=xlNormal, CreateBackup:=False

'Substitute following code to save in XL2007 format
'ActiveWorkbook.SaveAs Filename:= _
strSavePath & rngFileName.Value & ".xlsx", _
FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False

ActiveWindow.Close

Next rngFileName

End Sub

--
Regards,

OssieMac


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create WorkBooks based List Adams SC[_2_] Excel Programming 1 March 27th 09 03:16 PM
Creating a unique list of Cost Codes in Col. A from all worksheets in all workbooks in folder X u473 Excel Programming 1 October 22nd 07 05:24 PM
Creating separate workbooks based on filter BerkshireGuy Excel Programming 1 August 24th 07 06:28 PM
creating a list based criteria jjordan Excel Programming 0 May 21st 07 12:52 AM
Creating a List based on your choice from Another List Cristi Excel Discussion (Misc queries) 1 August 14th 06 06:00 PM


All times are GMT +1. The time now is 03:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"