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.
Syntax to Rename Workbook Method
Here is the following syntax to Rename Workbook.
Name Old_Name As New_Name
VBA Code to Rename Workbook in Excel
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
Instructions to Run VBA Macro Code or Procedure:
You can refer the following link for the step by step instructions.
Instructions to run VBA Macro Code
Other Useful Resources:
Click on the following links of the useful resources. These helps to learn and gain more knowledge.
VBA Tutorial VBA Functions List VBA Arrays in Excel Blog
VBA Editor Keyboard Shortcut Keys List VBA Interview Questions & Answers