I'm not sure what you mean in steps 3 and 4, but you can try something
like
Sub AAA()
Dim DirName As String
Dim Res As VbMsgBoxResult
DirName = "C:\Test\Test2"
If Dir(DirName, vbDirectory) = vbNullString Then
' directory does not exist
Res = MsgBox("Rewrite?", vbYesNo)
If Res = vbYes Then
' user clicked Yes
Else
' user clicked No
End If
Else
' directory exists
End If
End Sub
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
On Mon, 5 Jan 2009 13:23:02 -0800, Maperalia
wrote:
I have a macro that creates a directory (see below). However, I would like to
have a statement to tell me the following:
1.- Find if directory already exist.
2.- Have a window message to give me the option “YES” or “NO” to rewrite it.
3.- If I click “YES” I will rewrite it.
4.- If I click “NO” I will came back to retype the information.
Thanks in advance.
Maperalia.
'$$$$ START CREATE NEW DIRECTORY $$$$$$$$$$$$$$$$$$$$$$$$$$
NewDir = Format(Sheets("Test").Range("D5").Value)
MkDir "C:\Mario\Radius and Flat Bend\ColorLINE\Radial\ColorLine Template\" &
_ Format(Sheets("Test").Range("D5").Value)
'$$$$ END CREATE NEW DIRECTORY $$$$$$$$$$$$$$$$$$$$$$$$$$