1,dim a as string a =format$(now(),"yyyyymmdd") call createemptyfile(a & ".txt") ===================================Public Sub CreateEmptyFile(Optional ByVal isFileFullName As String = "") On Error GoTo CreateEmptyFile_Error
Dim iFileHand As Integer
If isFileFullName <> "" Then iFileHand = FreeFile Open isFileFullName For Output As #iFileHand Close #iFileHand End If
FileFullName = isFileFullName
GoTo WayOut CreateEmptyFile_Error: WayOut: End Sub2, Sub MkDir(Path As String) VBA.FileSystem 的成员 创建一个新的目录或文件夹3,追加 Dim iFileNum As Integer Dim strFileName As String
a =format$(now(),"yyyyymmdd")
call createemptyfile(a & ".txt")
===================================Public Sub CreateEmptyFile(Optional ByVal isFileFullName As String = "")
On Error GoTo CreateEmptyFile_Error
Dim iFileHand As Integer
If isFileFullName <> "" Then
iFileHand = FreeFile
Open isFileFullName For Output As #iFileHand
Close #iFileHand
End If
FileFullName = isFileFullName
GoTo WayOut
CreateEmptyFile_Error:
WayOut:
End Sub2,
Sub MkDir(Path As String)
VBA.FileSystem 的成员
创建一个新的目录或文件夹3,追加
Dim iFileNum As Integer
Dim strFileName As String
iFileNum = FreeFile
strFileName = App.Path & "\Test.log"
Open strFileName For Append As #iFileNum
Print #iFileNum, "tets"
Close #iFileNum