Premium Only Content

Excel VBA: Check If File or Folder Exists (DIR) - Open File or Create Folder
November 22, 2018 Excel VBA & Macros Tutorials
Use the DIR function in Excel VBA to check if a file or a folder exist. You can then decide what to do if they exist. For example you can open the Workbook to copy values from and then close the workbook.
I will also show you how you can handle cases where the file does not exist or the file name is not typed correctly. In that case VBA generates an error but you can easily avoid with the IF statement.
[5:10] I also show you how you can check with VBA if a folder exists. and if it doesn't exist, how you can create the folder. We use the message box function to ask the user for permission if we should create the folder or not.
🡻 Download the workbook here: https://www.xelplus.com/excel-vba-check-if-file-folder-exists-dir/
★ Links to related videos: ★
Learn about declaring variables in VBA: https://youtu.be/zfc9TYH3UvY
Complete Excel VBA free course (playlist): https://www.youtube.com/playlist?list=PLmHVyfmcRKyzmbDy6QoBuUDrU5D-jD-Se
★★ My Online Excel Courses ★★
Courses ► https://courses.xelplus.com/
✉ Subscribe & get my TOP 10 Excel formulas e-book for free
https://www.xelplus.com/free-ebook/
★ Excel Resources I Recommend
https://www.xelplus.com/resources/
Get Office 365: https://microsoft.msafflnk.net/15OEg
Microsoft Surface: https://microsoft.msafflnk.net/c/1327040/451518/7593
GEAR
Camera: https://amzn.to/2FLiFho
Screen recorder: http://techsmith.pxf.io/c/1252781/347799/5161
Microphone: https://amzn.to/2DVKstA
Lights: http://amzn.to/2eJKg1U
Note: This description contains affiliate links, which means at no additional cost to you, we will receive a small commission if you make a purchase using the links. This helps support the channel and allows us to continue to make videos like this. Thank you for your support!
#ExcelVBA
-
LIVE
Jeff Ahern
1 hour agoThe Saturday Show with Jeff Ahern
14,460 watching -
LIVE
Major League Fishing
2 days agoLIVE Tackle Warehouse Invitationals Championship, Day 2
130 watching -
LIVE
Lara Logan
16 hours agoSTANDING AGAINST THE GLOBAL ELITE with Trump Ally President Milorad Dodik of Republika Srpska | Ep34
1,287 watching -
LIVE
Total Horse Channel
18 hours ago2025 Reno Snaffle Bit Futurity | Saturday
2,684 watching -
1:22:10
Michael Franzese
3 hours agoI'm Calling Out All The Nonsense From The Left & "New" Epstein Files
54K43 -
4:06:45
Grant Cardone
4 hours ago10X Wealth System LIVE: Keep More. Pay Less. Build Faster.
6.71K -
LIVE
TheManaLord Plays
3 hours agoMANA SUMMIT - DAY 1 ($10,200+) | BANNED PLAYER SMASH MELEE INVITATIONAL
240 watching -
2:35:48
I_Came_With_Fire_Podcast
17 hours agoCarolina Bays: The Lost Cataclysm You've Never Heard Of
23.7K8 -
59:56
X22 Report
22 hours agoMr & Mrs X - [DS] Trafficking Empire – The Pedo Network Island, The Cover-Up: Part 2 - Ep 6
103K38 -
1:03:07
Candace Show Podcast
2 days agoI’M BACK! And STILL Asking Questions (Sorry Brigitte). | Candace Ep 233
133K228