Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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..................... |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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..................... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
'Trick' to restore original sort order after data modified? | Excel Discussion (Misc queries) | |||
Original cell formatting clears when I move contents | Excel Discussion (Misc queries) | |||
Auto save replaced my original file and now I need the original? | Excel Discussion (Misc queries) | |||
save a doument that has not been modified | Excel Discussion (Misc queries) | |||
How to get the original data in a cell after it is modified | Excel Programming |