程式1源码:
Option Explicit
Private Sub Form_Load()
Dim i As Integer
i = FreeFile
Open "c:\temp.txt" For Output As #i
Close i
End Sub
note:我在close i 设了个断点,所以文件会被占用;
程式2源码:
Option Explicit
Private Sub Command1_Click()
Dim fso As New FileSystemObject
Call fso.DeleteFile("c:\temp.txt", True)
End Sub
noted:执行 Call fso.DeleteFile("c:\temp.txt", True)会报错,没有使用权限;