ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro for Save As (https://www.excelbanter.com/excel-discussion-misc-queries/250376-macro-save.html)

Jeremy

Macro for Save As
 
I am looking for help with a macro that will run save as and place the file
in the same path as the file being saved as and adding a back to the end of
the file before .xls.

Origional file
B:\One\Two\Origional.xls

Save as file
B:\One\Two\Origionalback.xls

Thank you


מיכאל (מיקי) אבידן

Macro for Save As
 
In principal, thsi is waht you are looking for:
==================
Sub SaveAsBAckUp()
NFN = Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4) & "BACK"
FULL = ActiveWorkbook.Path & "\" & NFN & ".XLS"
ActiveWorkbook.SaveAs FULL
End Sub
==============
Note: Running the macro - TWICE - on the same File will add another BACK
string.
If you intend to run it on the same file more than once then add a check for
the presence of BACK in the name - normally this is done with INSTR command.
Micky


"Jeremy" wrote:

I am looking for help with a macro that will run save as and place the file
in the same path as the file being saved as and adding a back to the end of
the file before .xls.

Origional file
B:\One\Two\Origional.xls

Save as file
B:\One\Two\Origionalback.xls

Thank you


Jeremy

Macro for Save As
 
Works great but I forgot to add one thing. How would you put the current
date at the end of "Back"?

Thank you

"מיכאל (מיקי) אבידן" wrote:

In principal, thsi is waht you are looking for:
==================
Sub SaveAsBAckUp()
NFN = Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4) & "BACK"
FULL = ActiveWorkbook.Path & "\" & NFN & ".XLS"
ActiveWorkbook.SaveAs FULL
End Sub
==============
Note: Running the macro - TWICE - on the same File will add another BACK
string.
If you intend to run it on the same file more than once then add a check for
the presence of BACK in the name - normally this is done with INSTR command.
Micky


"Jeremy" wrote:

I am looking for help with a macro that will run save as and place the file
in the same path as the file being saved as and adding a back to the end of
the file before .xls.

Origional file
B:\One\Two\Origional.xls

Save as file
B:\One\Two\Origionalback.xls

Thank you



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

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