Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to bypass MkDir when that Dir exists already
I have macro which creates Subdirectories. I need to bypass MkDir command if
that folder already exists. How do you do that? Thanks for your help. Jan |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to bypass MkDir when that Dir exists already
If Dir("C:\My Doucuments") < vbNullString Then
End If -- Regards Dave Hawley www.ozgrid.com "Jan Nademlejnsky" wrote in message ... I have macro which creates Subdirectories. I need to bypass MkDir command if that folder already exists. How do you do that? Thanks for your help. Jan |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to bypass MkDir when that Dir exists already
I found it:
Sub DirectoryExists() FPath = Range("B2") If Dir(FPath) = "" Then '.....If Dir("C:\Users\Owner\Documents\ExcelF\") = "" Then MsgBox "It does not exists" Else MsgBox "It is already there" End If End Sub "Jan Nademlejnsky" wrote in message ... I have macro which creates Subdirectories. I need to bypass MkDir command if that folder already exists. How do you do that? Thanks for your help. Jan |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to bypass MkDir when that Dir exists already
"Jan Nademlejnsky" schrieb im Newsbeitrag
... I have macro which creates Subdirectories. I need to bypass MkDir command if that folder already exists. How do you do that? Thanks for your help. Jan As others already sugested, check if the Dir exists. Or try to create the Dir and simply ignore the error: On Error Resume Next 'instruct VBA to ignore any error MkDir "MyNewSubdir" On Error GoTo 0 'no error handling or On Error GoTo MyErrorHandler 'reenable your previous 'error handling Helmut. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
MkDir question | Excel Programming | |||
Problems with MkDir | Excel Programming | |||
mkdir | Excel Programming | |||
mkdir problem | Excel Programming | |||
mkdir problem | Excel Programming |