Test if folder exists, create if it doesn't?

  • Thread starter Thread starter 43fan
  • Start date Start date
4

43fan

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)
 
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
 
Back
Top