![]() |
Test if folder exists, create if it doesn't?
I'm sure this is simple, but after going through the Excel help file, all it
has done is confuse me. ;) Basically, I just want to see if a folder exists, if it does, change to the folder, if it doesn't, create it, then change to there. I'll be getting user inputs that will be concatenated to come up with the folder name I'm looking for/changing to. As well, I'll use that same info to name some files that will be saved into that folder. Thanks!! Shawn -- Join the newest in Fantasy Sports. http://www.6FantasySports.com (this site supports the Victory Junction Gang Camp with a portion of all proceeds) |
Test if folder exists, create if it doesn't?
Shawn,
Try something like the following: Dim PathName As String PathName = "C:\Temp" On Error Resume Next MkDir PathName On Error GoTo 0 ChDrive PathName ChDir PathName -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "43fan" wrote in message ... I'm sure this is simple, but after going through the Excel help file, all it has done is confuse me. ;) Basically, I just want to see if a folder exists, if it does, change to the folder, if it doesn't, create it, then change to there. I'll be getting user inputs that will be concatenated to come up with the folder name I'm looking for/changing to. As well, I'll use that same info to name some files that will be saved into that folder. Thanks!! Shawn -- Join the newest in Fantasy Sports. http://www.6FantasySports.com (this site supports the Victory Junction Gang Camp with a portion of all proceeds) |
All times are GMT +1. The time now is 08:03 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com