ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Creating directories from excel (https://www.excelbanter.com/excel-programming/308197-re-creating-directories-excel.html)

Jean-Yves[_2_]

Creating directories from excel
 
Hi Kevin
The Dir function test the existence of the folder (works for file as well)
MkDir create the specified directory

Sub test()
If Dir("C:\TempTest\") = "" Then
MkDir ("C:\TempTest\")
End If
End Sub
Regards,
Jean-Yves

"Keivn Green" wrote in message
...
I would like to create a directory using a macro which is easy enough, but
how can I have it verify whether or not its there?

would it be "if dir: blablabla = true then"?




Tom Ogilvy

Creating directories from excel
 

You can also just skip the test and create it. If it exists, an error will
be raised which can be ignored

Sub test()
On Error Resume Next
MkDir ("C:\TempTest\")
On Error goto 0
End Sub

--
Regards,
Tom Ogilvy


"Keivn Green" wrote in message
...
ThankYou!!!

"Jean-Yves" wrote:

Hi Kevin
The Dir function test the existence of the folder (works for file as

well)
MkDir create the specified directory

Sub test()
If Dir("C:\TempTest\") = "" Then
MkDir ("C:\TempTest\")
End If
End Sub
Regards,
Jean-Yves

"Keivn Green" wrote in message
...
I would like to create a directory using a macro which is easy enough,

but
how can I have it verify whether or not its there?

would it be "if dir: blablabla = true then"?








All times are GMT +1. The time now is 08:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com