How can i overwrite a txt file if it exist and create the txt file if it dosent exist, i have tried the code below but with no luck.
Code:
Set fso = CreateObject("Scripting.FileSystemObject")
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists("C:\Data\SCRIPTS\") Then
If objFSO.FileExists("C:\Data\SCRIPTS\" & strComputer & ".txt") Then
Set ts = Fso.OpenTextFile ("C:\Data\SCRIPTS\" & strComputer & ".txt", ForWriting, TRUE)
ts.write report
ts.write software
Else
Set ts = fso.CreateTextFile ("C:\Data\SCRIPTS\" & strComputer & ".txt", ForWriting)
ts.write report
ts.write software
End If
End If