| 网站首页 | 新闻 | 新书 | 专家 | 技巧 | 源码作品 | 工具/资源 | 商城 | 风采 | 留言 | 论坛 | 网址 | 承接 | 
您现在的位置: Access/Office中国 >> 技巧 >> Access >> OFFICE集成系统 >> 文章正文 用户登录 新用户注册
新增并将内容写入文本文件         
新增并将内容写入文本文件
作者: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 
  • 上一篇文章:

  • 下一篇文章:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    专 题 栏 目
    最 新 热 门
    最 新 推 荐
    相 关 文 章
    如何判断一个工作表里有
    网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)