Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default open save as from list

I have a spreadsheet with 150 names
I have a template
I need to open the template and save as a name from the names spreadsheet
this should leave me with 150 seperate files each with a name from the list
I assume a macro is the best way to do this
Thanxs in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default open save as from list

The code below should work check the follwing
1) the GetOpenFileName I used XLT as the extension. Change as required
2) I didn't know if the Range of Filenames contained an extension. I
added "xls" to the filenames. Remove if the names on your worksheet already
contains an extension
3) Change the SaveFolder as required.
4) Change FileNameRange as required.

Sub savefiles()

SaveFolder = "c:\temp\"
Set FileNameRange = Sheets("Sheet1").Range("A1:A20")

filetoopen = Application _
.GetOpenFilename("Templet Files (*.xlt), *.xlt")
If filetoopen = False Then
MsgBox ("Cannot open Templet -= exiting sug")
Exit Sub
End If

Set Templet = Workbooks.Open(Filename:=filetoopen)

For Each FName In FileNameRange
If FName < "" Then
Set Templet = Workbooks.Open(Filename:=filetoopen)
Templet.SaveAs Filename:=Folder & FName.Value & ".xls"
Templet.Close
End If
Next FName

End Sub


"seans" wrote:

I have a spreadsheet with 150 names
I have a template
I need to open the template and save as a name from the names spreadsheet
this should leave me with 150 seperate files each with a name from the list
I assume a macro is the best way to do this
Thanxs in advance

Reply
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
whenever open or save it is very slow to open Nav J Excel Discussion (Misc queries) 1 August 13th 09 02:32 PM
excel macro to open Sharepoint list in excel and save in my folde kay Excel Programming 0 July 24th 08 09:46 PM
open (or save to) other workbooks Hernan Excel Programming 0 December 27th 06 01:24 AM
Open and Save XML Eric Excel Discussion (Misc queries) 0 May 14th 05 12:28 AM
Cancel in Save As and Open Con[_3_] Excel Programming 2 January 5th 04 12:50 PM


All times are GMT +1. The time now is 05:17 AM.

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

About Us

"It's about Microsoft Excel"