» Determine if a workbook exists using VBA in Microsoft Excel
VBA macro tip contributed by Erlandsen Data Consulting offering Microsoft Excel Application development, template customization, support and training solutions
CATEGORY - Files, Workbook, and Worksheets in VBA
VERSION - All Microsoft Excel Versions
The function below can be used to determine if a workbook or another file exists:
Function FileExists(FullFileName As String) As Boolean
' returns TRUE if the file exists
FileExists = Len(Dir(FullFileName)) > 0
End Function
Example:
If Not FileExists("C:\FolderName\SubFolder\FileName.xls") Then
MsgBox "The file doesn't exist!"
Else
Workbooks.Open "C:\FolderName\SubFolder\FileName.xls"
End If
Book Store:
Recommended Books:
- Microsoft Access Version 2002 Step by Step
- Special Edition Using Microsoft Access 2002
- Millionaire Real Estate Mentor : The Secrets of Financial Freedom through Real Estate Investing
- Financial Statement Analysis with S&P insert card
- Wall Street Journal Guide to Understanding Money and Investing
- AWAKEN THE GIANT WITHIN : HOW TO TAKE IMMEDIATE CONTROL OF YOUR MENTAL, EMOTIONAL, PHYSICAL AND FINANCIAL
No comments have been submitted.

