Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
My Code below is attempting to check if a folder exists and if so exit the
sub. Can anyone point me in the right direction mypath = "e:\Temp\" & Actuals If Dir(mypath) < "" Then MkDir mypath Else MsgBox "Folder already Exists" Exit Sub End If For i = lb To ub mypath = "e:\Temp\" & Actuals & Arr1(i) If Dir(mypath) = "" Then MkDir mypath End If Next i |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If Dir(mypath) = "" Then
MkDir mypath Else MsgBox "Folder already Exists" Exit Sub End If -- Regards, Tom Ogilvy "Jeff" wrote in message ... My Code below is attempting to check if a folder exists and if so exit the sub. Can anyone point me in the right direction mypath = "e:\Temp\" & Actuals If Dir(mypath) < "" Then MkDir mypath Else MsgBox "Folder already Exists" Exit Sub End If For i = lb To ub mypath = "e:\Temp\" & Actuals & Arr1(i) If Dir(mypath) = "" Then MkDir mypath End If Next i |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thx Tom,
I have one more question, how best to trap the error generated when the directory exists and the macro is attempting to overwrite it. How should I capture that error and process it? "Tom Ogilvy" wrote: If Dir(mypath) = "" Then MkDir mypath Else MsgBox "Folder already Exists" Exit Sub End If -- Regards, Tom Ogilvy "Jeff" wrote in message ... My Code below is attempting to check if a folder exists and if so exit the sub. Can anyone point me in the right direction mypath = "e:\Temp\" & Actuals If Dir(mypath) < "" Then MkDir mypath Else MsgBox "Folder already Exists" Exit Sub End If For i = lb To ub mypath = "e:\Temp\" & Actuals & Arr1(i) If Dir(mypath) = "" Then MkDir mypath End If Next i |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Error Resume Next
mkdir mypath On Error goto 0 -- Regards, Tom Ogilvy "Jeff" wrote in message ... Thx Tom, I have one more question, how best to trap the error generated when the directory exists and the macro is attempting to overwrite it. How should I capture that error and process it? "Tom Ogilvy" wrote: If Dir(mypath) = "" Then MkDir mypath Else MsgBox "Folder already Exists" Exit Sub End If -- Regards, Tom Ogilvy "Jeff" wrote in message ... My Code below is attempting to check if a folder exists and if so exit the sub. Can anyone point me in the right direction mypath = "e:\Temp\" & Actuals If Dir(mypath) < "" Then MkDir mypath Else MsgBox "Folder already Exists" Exit Sub End If For i = lb To ub mypath = "e:\Temp\" & Actuals & Arr1(i) If Dir(mypath) = "" Then MkDir mypath End If Next i |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Outlook problem ("no custom dictionary exist") | Excel Discussion (Misc queries) | |||
Excel VBA - Copy Folder problem | Excel Programming | |||
How to: check if folder exist, if not, create | Excel Programming | |||
Excel VBA - deleting populated folder problem | Excel Programming | |||
How to check if a folder/directory exist using VBA | Excel Programming |