R
red6000
Hi, I've got some code that move files, but I need the code to check if the
destination folder exists and if it doesn;t to create it.
I think I can do the code to create if, but not sure how to check if it
exists?
My code is below. I need help with the ***** bit. Thanks for any help.
Dim oldfilepath as String
Dim newfilepath as String
Dim myFile as String
Dim fso
oldfilePath = "C:\old\"
newfilePath = "C:\new\"
myFile = "randomfile.doc"
Set fso = CreateObject("Scripting.FileSystemObject")
***** if newfilepath exists then
'do nothing
else
fso.CreateFolder(newfilepath)
end if
oldfilepath = oldfilepath & myFile
newfilepath = oldfilepath & myFile
Name oldfilepath As newfilepath
destination folder exists and if it doesn;t to create it.
I think I can do the code to create if, but not sure how to check if it
exists?
My code is below. I need help with the ***** bit. Thanks for any help.
Dim oldfilepath as String
Dim newfilepath as String
Dim myFile as String
Dim fso
oldfilePath = "C:\old\"
newfilePath = "C:\new\"
myFile = "randomfile.doc"
Set fso = CreateObject("Scripting.FileSystemObject")
***** if newfilepath exists then
'do nothing
else
fso.CreateFolder(newfilepath)
end if
oldfilepath = oldfilepath & myFile
newfilepath = oldfilepath & myFile
Name oldfilepath As newfilepath