hi
iam trying to delete a text file if it already exists.
this code will create and write but i need to add a line before it to delete the text file if it already exists.
Code
Dim rPrint As Range, rRow As Range, rCell As Range
Dim sRow As String, FileNumber As Integer
Dim ProstixAddress As String
Dim ProstixFile As String
Set rPrint = Sheet6.Range("A2:a100") ' Range to export
FileNumber = FreeFile
ProstixFile = Sheet12.Range("a1").Value
'ProstixFile = TextBox1.Value
'CHANGE ADDRESS TO SEND TO DESIRED LOCATION
'NOTHSIDES ADDRESS IS ---> "P:\Mitek\" + ProstixFile + ".txt" For Output As #FileNumber
'Open "P:\Mitek\" + ProstixFile + ".txt" For Output As #FileNumber
Open "C:\Documents and Settings\Owner\Desktop\" + ProstixFile + ".mta" For Output As #FileNumber ' Create file
For Each rRow In rPrint.Rows
sRow = ""
For Each rCell In rRow.Cells
sRow = sRow & rCell.Text & ","
Next rCell
Print #FileNumber, Left(sRow, Len(sRow) - 1)
Next rRow
Close #FileNumber ' Close file
Unload Me
Display More
any ideas?
cheers
toe