我试图复制位于一个文件路径的整个未打开的工作簿,重命名并将其保存到新目录...我有重命名和保存的问题,这是我的代码到目前为止:
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
Run Code Online (Sandbox Code Playgroud)
我要复制的文件位于ToolFilePath中的路径中,我想要将其重命名为的是DestFilePath,其中包含excel .xlsm扩展名.
我哪里错了?
谢谢