| 新增并将内容写入文本文件 |
|
| 作者:harsonli… 文章来源:第十空间 点击数: 本日:{$DayHits} 更新时间:2003-12-20 22:46:43 |
|
以下用了两种方法。摘自harsonliao的火宇代码库源程序中
Sub MakeFile(strFile As String) On Error GoTo err_section 'Dim fs As Object 'Dim a Dim strPath As String
strPath = CurrentProject.Path If Dir(strPath & "\Temp") = "" Then MakeSureDirectoryPathExists (strPath & "\Temp\") '文件名及路径 strPath = strPath & "\Temp\Temp.txt" '如文件已存在则删除 If Dir(strPath) <> "" Then Kill strPath
'Set fs = CreateObject("Scripting.FileSystemObject") 'Set a = fs.CreateTextFile(strPath, True) 'a.WriteLine (strFile) 'a.Close
Open strPath For Output As 1 Print #1, strFile Close #1
exit_section: Exit Sub
err_section: MsgBox "Error in cmdBuild_Click - " & Err & " - " & Err.Description Resume exit_section End Sub
|
| 文章录入:tmtony 责任编辑:tmtony |
|
上一篇文章: 格式化读取文本文件
下一篇文章: 怎样可以从ACCESS中打印一个WORD文档 |
| 【字体:小 大】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 |