![]() |
Move one ws to new wb. Save new Wb with same but modified name as original WB
Greetings:
Looking to name a new WB with the (modified) name of the original WB. The following code MOVES one worksheet to a new WB. ' MOVE "COM.CALC to NEW WorkBook Sheets("COM.CALC.").Move At this point the new WB is the active one. I'm looking to get the (previously saved) file name from the original file, and use it on the new file, with "-CC" added to the end. The original file name will always be different. (its not a template with a "fixed" name) The path for the new WB always to be the same. So new file to save as: C:\CONTRACTS COMMISH\OldFileName-CC. Then the old file is to be closed without a save. Thanks all in advance..................... |
Move one ws to new wb. Save new Wb with same but modified name as
This has not been tested.
Assuming that the procedure is in the original workbook's code module: Sub moveSheet() Dim myPath As String, wbNewName As String myPath = ThisWorkbook.Path wbNewName = ThisWorkbook.Name & "my suffix" Sheets("COM.CALC.").Move 'Not sure about the period after CALC ActiveWorkbook.SaveAs FileName:=myPath & "\" & wbNewName End Sub "BEEJAY" wrote: Greetings: Looking to name a new WB with the (modified) name of the original WB. The following code MOVES one worksheet to a new WB. ' MOVE "COM.CALC to NEW WorkBook Sheets("COM.CALC.").Move At this point the new WB is the active one. I'm looking to get the (previously saved) file name from the original file, and use it on the new file, with "-CC" added to the end. The original file name will always be different. (its not a template with a "fixed" name) The path for the new WB always to be the same. So new file to save as: C:\CONTRACTS COMMISH\OldFileName-CC. Then the old file is to be closed without a save. Thanks all in advance..................... |
All times are GMT +1. The time now is 12:45 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com