VBA Create a new Excel file from template

Опубликовано: 12 Октябрь 2024
на канале: Simplified Excellence
1,862
6

Create a new Excel file from an existing one serving as a template

Code:
Sub use_file_as_template()

'use current file as template for a new Excel file

Dim myNewFile As Workbook
Dim path_file_template As String

'identify path of template file
path_file_template = "C:\Users\brunduk\Documents\Tutorials\Test file.xlsx"

'open new Excel file based on template file
Set myNewFile = Application.Workbooks.Add(path_file_template)

'set focus on new file
myNewFile.Activate

End Sub

-------------------------------
NEED HELP?
-------------------------------
Leave a comment with your questions, issues or projetcs and I will try to answer with a video.

-------------------------------
THANK YOU
-------------------------------
For watching my videos,
Your shares
And your comments!