I am trying to copy an entire unopened workbook located at one file path, rename it and save it to a new directory... I am having issues with the renaming and saving, here is my code thus far:
Private Sub new_file_Click()
Dim ActBook As Workbook, NewFile As String
Dim ToolFilePath As String, DestFilePath As String, NewToolName As String
NewToolName = InputBox("Enter the Tool Name.")
MsgBox (Tools_ListBox.Value)
ToolFilePath = GetToolPath(Tools_ListBox.Value)
ToolFilePath = GetPath & ToolFilePath
DestFilePath = GetPath & GetDestPath(Tools_ListBox.Value) & NewToolName & ".xlsm"
Set ActBook = Workbooks.Add(ToolFilePath)
ActBook.SaveAs DestFilePath
ActBook.Close True
The file that i want to copy is located at the path in ToolFilePath and the located I want to rename it to is DestFilePath, which includes the excel .xlsm extension.
Where am I going wrong?
Thanks
You can also use the NAME method if you do not wish to retain the original file.
Why not just use:
No need to open it.