R_N_WARD
asked on
Creating a File from Command_click
I want the computer to create a file (namely A:\DAT1.DAT) when the user presses CmdFile_click. I also want code that will find if that file is already on the disk and ask the user if they wish to replace it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Private Sub CmdFile_Click()
Dim exists As Boolean
Dim i As Integer
Dim filesys As Object
Set filesys = CreateObject("Scripting.Fi
exists = filesys.FileExists("c:\win
If exists Then
i = MsgBox("File Exists Already. Do you wish to overwrite it?", _
vbYesNo)
If i = vbYes Then _
filesys.CreateTextFile "c:\windows\desktop\dat1.d
Else
filesys.CreateTextFile ("c:\windows\desktop\dat1.
End If
End Sub