From the course: Excel VBA: Managing Files and Data
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Determine if a workbook exists - Microsoft Excel Tutorial
From the course: Excel VBA: Managing Files and Data
Determine if a workbook exists
- [Instructor] Much of the Excel VBA code that you write will operate on the workbook that is currently open. However, more advanced routines will need to open, close and otherwise operate on workbooks elsewhere on your system or somewhere over a network. In this movie, I will show you how to determine whether a particular workbook even exists. My sample file is 0201, does it exist? And that is an Excel macro enabled workbook that you can find in the chapter two folder of your exercise files collection. I won't be working with the body of the workbook instead we'll just go with VBA code. So I'll press alt F11 to move to the visual basic editor. And here you see that I have a code module already open. I have a function at the top that will check for a file and then a subroutine that calls the function and it displays a result. I'll start by adding the only line of code that we need in the function. And that is what we'll…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Determine if a workbook exists4m 36s
-
(Locked)
Determine if a folder (directory) exists4m 49s
-
(Locked)
Detect whether a file is open5m 6s
-
(Locked)
Open a workbook2m 35s
-
(Locked)
Close a workbook5m 31s
-
(Locked)
Save a workbook under a new name4m 21s
-
(Locked)
Save a workbook as a CSV file4m 43s
-
(Locked)
-
-
-
-
-
-