View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Helmut Meukel Helmut Meukel is offline
external usenet poster
 
Posts: 49
Default 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.