Delete File Method
The Delete File method deletes a file. It does not return a value. It only deletes files. It does not delete directories. You can use the Delete Directory method to delete a directory.
Format
Kill pathname
The following table describes the arguments that you can use with this method.
Argument | Description |
---|---|
pathname |
A string expression that identifies a valid DOS file specification. It can include paths and the following wildcards:
|
Example
The following example does the following work:
Prompts a user for an account number.
Opens a file.
Searches the file for the account number.
Displays the matching letter for that number.
The CreateFile subroutine creates the c:\temp001 file that the main subroutine uses. The first subroutine uses the Kill statement to delete the file after Siebel CRM finishes processing:
(general) (declarations)
Option Explicit
Declare Sub CreateFile
Global x as Integer
Global y(100) as String
Sub CreateFile
' Put the numbers 1-10 and letters A-J into a file
Dim startletter
Open "c:\temp001" for Output as #1
startletter = 65
For x = 1 to 10
y(x) = Chr(startletter)
startletter = startletter + 1
Next x
For x = 1 to 10
Write #1, x,y(x)
Next x
Close #1
End Sub
Sub Button_Click
Dim acctno as Integer
Dim msgtext
Call CreateFile
i: acctno = 6
If acctno<1 Or acctno>10 then
Goto i:
End if
x = 1
Open "c:\temp001" for Input as #1
Do Until x = acctno
Input #1, x,y(x)
Loop
msgtext = "The letter for account number " & x & " is: _
" & y(x)
Close #1
kill "c:\temp001"
End Sub