Open And Close Workbook With VBA
Let’s do it in Excel using VBA. You want to have macro which can open and close Excel workbook. Let’s see a VBA code, which does it.
Sub OpenCloseWorkbook() Dim MonthlyWB As Variant Dim FileName As String MonthlyWB = Application.GetOpenFilename( _ FileFilter:="Microsoft Excel Workbooks, *.xls; *.xlsx", Title:="Open Workbook") Workbooks.Open MonthlyWB FileName = ActiveWorkbook.Name Workbooks(FileName).Close End Sub
This macro can open and also close your workbook.
Advantage is that it will also work if a file name changed.
Template
You can download the Template here – Download
Further reading: Basic concepts Getting started with Excel Cell References