![]() |
save as
Is it possible to have a macro that will save as a new file with value from
a particular field say the current file is Report.xls say the value in sheet1 and range B3 is "14/03/2006" The file should save as " Report 14/03/2006 .xls" |
save as
with Workbooks("Report.xls")
.SaveAs format(.Worksheets("Sheet1").Range("B3").value, "dd-mm-yyyy") & ".xls" end with I modified the date format because / are not authorized in file names. HTH -- AP "flow23" a écrit dans le message de ... Is it possible to have a macro that will save as a new file with value from a particular field say the current file is Report.xls say the value in sheet1 and range B3 is "14/03/2006" The file should save as " Report 14/03/2006 .xls" |
save as
thanks it works great
can I also add the location of the file name to a particualr folder on the network? "Ardus Petus" wrote: with Workbooks("Report.xls") .SaveAs format(.Worksheets("Sheet1").Range("B3").value, "dd-mm-yyyy") & ".xls" end with I modified the date format because / are not authorized in file names. HTH -- AP "flow23" a écrit dans le message de ... Is it possible to have a macro that will save as a new file with value from a particular field say the current file is Report.xls say the value in sheet1 and range B3 is "14/03/2006" The file should save as " Report 14/03/2006 .xls" |
save as
The original Filename portion "Report" is not being picked up
in the new filename; Only the date. TIA, "Ardus Petus" wrote: with Workbooks("Report.xls") .SaveAs format(.Worksheets("Sheet1").Range("B3").value, "dd-mm-yyyy") & ".xls" end with I modified the date format because / are not authorized in file names. HTH -- AP "flow23" a écrit dans le message de ... Is it possible to have a macro that will save as a new file with value from a particular field say the current file is Report.xls say the value in sheet1 and range B3 is "14/03/2006" The file should save as " Report 14/03/2006 .xls" |
save as
OK,
After modifying line to: (.name being added) .SaveAs .name format(.Worksheets("Sheet1").Range("B3").value, "dd-mm-yyyy") & ".xls" It works as expected. Tks, "Jim May" wrote: The original Filename portion "Report" is not being picked up in the new filename; Only the date. TIA, "Ardus Petus" wrote: with Workbooks("Report.xls") .SaveAs format(.Worksheets("Sheet1").Range("B3").value, "dd-mm-yyyy") & ".xls" end with I modified the date format because / are not authorized in file names. HTH -- AP "flow23" a écrit dans le message de ... Is it possible to have a macro that will save as a new file with value from a particular field say the current file is Report.xls say the value in sheet1 and range B3 is "14/03/2006" The file should save as " Report 14/03/2006 .xls" |
save as
One way:
with Workbooks("Report.xls") .SaveAs "\\yoursharename\yourfoldername1\yourfoldernam e2\" & "Report " & _ format(.Worksheets("Sheet1").Range("B3").value, "dd-mm-yyyy") & ".xls" end with flow23 wrote: thanks it works great can I also add the location of the file name to a particualr folder on the network? "Ardus Petus" wrote: with Workbooks("Report.xls") .SaveAs format(.Worksheets("Sheet1").Range("B3").value, "dd-mm-yyyy") & ".xls" end with I modified the date format because / are not authorized in file names. HTH -- AP "flow23" a écrit dans le message de ... Is it possible to have a macro that will save as a new file with value from a particular field say the current file is Report.xls say the value in sheet1 and range B3 is "14/03/2006" The file should save as " Report 14/03/2006 .xls" -- Dave Peterson |
save as
Many thanks
"Dave Peterson" wrote: One way: with Workbooks("Report.xls") .SaveAs "\\yoursharename\yourfoldername1\yourfoldernam e2\" & "Report " & _ format(.Worksheets("Sheet1").Range("B3").value, "dd-mm-yyyy") & ".xls" end with flow23 wrote: thanks it works great can I also add the location of the file name to a particualr folder on the network? "Ardus Petus" wrote: with Workbooks("Report.xls") .SaveAs format(.Worksheets("Sheet1").Range("B3").value, "dd-mm-yyyy") & ".xls" end with I modified the date format because / are not authorized in file names. HTH -- AP "flow23" a écrit dans le message de ... Is it possible to have a macro that will save as a new file with value from a particular field say the current file is Report.xls say the value in sheet1 and range B3 is "14/03/2006" The file should save as " Report 14/03/2006 .xls" -- Dave Peterson |
save as
I bet you'd want to strip the .xls out of the .name property, too.
Jim May wrote: OK, After modifying line to: (.name being added) .SaveAs .name format(.Worksheets("Sheet1").Range("B3").value, "dd-mm-yyyy") & ".xls" It works as expected. Tks, "Jim May" wrote: The original Filename portion "Report" is not being picked up in the new filename; Only the date. TIA, "Ardus Petus" wrote: with Workbooks("Report.xls") .SaveAs format(.Worksheets("Sheet1").Range("B3").value, "dd-mm-yyyy") & ".xls" end with I modified the date format because / are not authorized in file names. HTH -- AP "flow23" a écrit dans le message de ... Is it possible to have a macro that will save as a new file with value from a particular field say the current file is Report.xls say the value in sheet1 and range B3 is "14/03/2006" The file should save as " Report 14/03/2006 .xls" -- Dave Peterson |
All times are GMT +1. The time now is 02:46 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com