VBA Rename Workbook is to rename workbook using Name As. Workbook represents an object. It is part of workbooks collection. We can rename active Workbook and can’t rename current Workbook. We can save as current workbook with another name. And then we can delete existing current file or Workbook. We can rename any file or workbook using Name As. The Current Workbook/file and New Workbook/file path should be same while renaming Workbook.
Here is the following syntax to Rename Workbook.
Name Old_Name As New_Name
Let us see the following example. It will rename Workbook .
'VBA ReName Workbook in Excel Sub VBA_ReName_Workbook() 'Variable declaration Dim sOldFile As String Dim sNewFile As String sOldFile = "D:\VBAF1\Old_File.xlsx" sNewFile = "D:\VBAF1\New_File.xlsx" Name sOldFile As sNewFile End Sub
You can refer the following link for the step by step instructions.
Click on the following links of the useful resources. These helps to learn and gain more knowledge.