From the course: Excel VBA: Managing Files and Data

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Close a workbook

Close a workbook - Microsoft Excel Tutorial

From the course: Excel VBA: Managing Files and Data

Start my 1-month free trial

Close a workbook

- [Instructor] When you write VBA code, you can open any workbook that you need to operate on. When you're done, you should close them. In this movie, I will show you various ways to close your Excel workbooks. I will use two sample files, you can find them both in the chapter two folder of the exercise files collection. The first is called 0205 close workbook, and that's a macro enabled workbook. And I'll press Alt-Tab to move to the other one, which is Target.xlsx. And that is just a regular workbook. And you can see that in fact, it doesn't contain any data or just using it to manipulate. Unpress Alt-Tab to move back to my first workbook and then press Alt-F11, to move to the Visual Basic Editor. Here I have a code module and in it I have a sub routine called close a workbook and two lines of code are commented out. I'll describe those in a few minutes. The first method I'll demonstrate is to close the active…

Contents