hi i have created the excel reports and it is stored in the location of my computer i.e. D:\excel\with the unique excel report names based on the dates .This agent is scheduled and runs evryday which generates and stores the excel sheet with current date of the system.It is working fine.
i have done this by the following code:-
“D:\excel" + “+Cstr(Day(Now()))+”-”+Cstr(Month(Now()))+“-”+Cstr(Year(Now()))
But the problem is that if i have generate the reports more than one then that report(same date) will already be thr.
Now what i have done i have used:-
Kill filename ->>>to kill the existing report of the same file name.
This i have done by first uncommenting Kill filename (whenever required) in the agent.
I want to know how can i find whether the same file already exists thr or not.And if same file already exists then only i have use Kill filename else don’t use Kill filename
Subject: Problem in finding duplicate excel sheets stored in a directory thru lotusscript?
Dear Vinod,
Following piece of code will do
filename=“Name of your file without path”
ret = Dir$("D:\excel"+ fileName)
If retval<>filename Then
call kill filename
end if
cheers

Subject: RE: Problem in finding duplicate excel sheets stored in a directory thru lotusscript?
sorry thr was a small mistake in above code…Please find the corrected code below…
filename=“Name of your file without path”
retval = Dir$("D:\excel"+ fileName)
If retval<>filename Then
call kill "D:\excel"+filename
end if
hope this will work

Subject: Problem in finding duplicate excel sheets stored in a directory thru lotusscript?
fileName="PSR - " +Cstr(Day(Now()))+"-"+Cstr(Month(Now()))+"-"+Cstr(Year(Now())) Msgbox Dir$("C:\VinodKumar\PSR\PSR - 12-3-2009",0)
ret = Dir$("C:\VinodKumar\PSR\PSR - 12-3-2009",0)
Msgbox ret
If ret = fileName Then
Msgbox "Inside If"
Kill "C:\VinodKumar\PSR\"&"PSR - " +Cstr(Day(Now()))+"-"+Cstr(Month(Now()))+"-"+Cstr(Year(Now()))
End If
Msgbox "Outside If"
'Dim fileName1 As String
' fileName1="C:\VinodKumar\PSR\"+ "PSR - " +Cstr(Day(Now()))+"-"+Cstr(Month(Now()))+"-"+Cstr(Year(Now()))
fileName="C:\VinodKumar\PSR\"&"PSR - " +Cstr(Day(Now()))+"-"+Cstr(Month(Now()))+"-"+Cstr(Year(Now()))
sir… iam not getting the satisfaction with this code,becoz it is not entering into the IF condition and pops up the msg “inside if” .if thr alerdy exists another same named file to kill it.
…else it is working and keeps on printing “outside if” even though the same named file already exists in the directory.
Subject: RE: Problem in finding duplicate excel sheets stored in a directory thru lotusscript?
I’m not sure I understand what you’re saying happens. If the “Inside if” message does not appear, that means the test condition of the if failed. The strings are not equal. Display their exact values. How are they different?
DebugStr function may help.
Subject: RE: Problem in finding duplicate excel sheets stored in a directory thru lotusscript?
you may not be providing complete file name…i mean you have to provide extension of the file as well…
It will work