hi .... im having trouble about how to not save text file...

'i create a textfile like this ..'
Set ts2 = fs.CreateTextFile(vtxt & "_" & Format(Date, "ddmmyy") & ".txt")

vsmg = "my text"

ts2.writeline (vsmg)

'call a notepad'
Call Shell("notepad.exe " & (vtxt & "_" & Format(Date, "ddmmyy") & ".txt"), vbNormalFocus)

ok here goes my problem , I want to false the below function but it showed me an error ..... In the other word, I dont wanna my Notepad which contain no error is being saved but ..... pls help me....

If lbl1.Caption = "NoError" Then Set ts2 = fs.CreateTextFile(vtxt & "_" & Format(Date, "ddmmyy") & ".txt") = False


U cant set it to false,
as it is not a proper syntax.
Just dont do anything in If Condition.
Come out of Creation procedure if ur label message is satisfied..


that's the things , how to come out from the creation procedure ? is it easier for me to delete the files that has been created ?

Set ts2 = fs.CreateTextFile(vtxt & "_" & Format(Date, "ddmmyy") & ".txt")

If lbl1.Caption = "No error" Then Set ts2 = fs.DeleteFile(vtxt & "_" & Format(Date, "ddmmyy") & ".txt")

there is an error showing Expected funciton or vairable ..... at fs.DeleteFile . i dont know why ... can u please explain it to me?


u need not set it to something ts2, just delete it:

fs.DeleteFile(vtxt & "_" & Format(Date, "ddmmyy") & ".txt")

There is another way to delete file:

[B]Kill [/B](vtxt & "_" & Format(Date, "ddmmyy") & ".txt")