ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Save as Macro (https://www.excelbanter.com/excel-programming/415804-save-macro.html)

nhollingdale

Save as Macro
 
Hi,
I am trying to produce a macro that will open a workbook in Excel and save
it as something else, but i would like to do this 150 times, i.e. 150
uniquely named workbooks. is it possible to create this?


Thanks
Nicola

dustinbrearton via OfficeKB.com

Save as Macro
 
Sure it is possible. Will it still take a long time to save that many files?
Yeah. You can use a for next and just have your for next variable added to
the end of base file name, say File was your base you could just say File1,
File2, File3.

Try something like this.


Sub OpenThis()

Dim worksheet_filepath As String
Dim x As Integer


Application.ScreenUpdating = False


worksheet_filepath = "C:\Temp\Temp"

Workbooks.Open Filename:= _
worksheet_filepath & "test.xls"




For x = 1 To 20
ActiveWorkbook.SaveAs worksheet_filepath & "\Test" & x & ".xls", xlNormal
Next

Application.ScreenUpdating = True

End Sub


nhollingdale wrote:
Hi,
I am trying to produce a macro that will open a workbook in Excel and save
it as something else, but i would like to do this 150 times, i.e. 150
uniquely named workbooks. is it possible to create this?

Thanks
Nicola


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200808/1



All times are GMT +1. The time now is 12:23 AM.

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