Check for directory then create
Hi,
- Add a reference to the Microsoft Scripting Runtime library (menu Tools
Reference).
- use someth8ing like:
Sub test()
Dim fso As Scripting.FileSystemObject
Dim path As String
path = "c:\test"
Set fso = New Scripting.FileSystemObject
If Not fso.FolderExists(path) Then 'does NOT exist, then create
''' create directory here
End If
''' now your FIleSave code
End Sub
--
Regards,
Sébastien
<http://www.ondemandanalysis.com
"Rex Mundi" wrote:
I have figured out how to have Excel create a directory and save a CSV
of the current workbook.
Now the macro hangs if the directory already exists. How do I check
for the directory and create only if needed.
TIA
|