以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://www.weistock.com/bbs/index.asp) -- 高级功能研发区 (http://www.weistock.com/bbs/list.asp?boardid=5) ---- 如何读取TXT文件内容? (http://www.weistock.com/bbs/dispbbs.asp?boardid=5&id=61080) |
-- 作者:deni977 -- 发布时间:2014/1/17 22:45:14 -- 如何读取TXT文件内容? 我们知道,在后台,可以用debugfile将变量输出到文件,反过来,要将TXT文件中的一个数值,如何读取到金字塔后台的变量中?深度请教! |
-- 作者:王锋 -- 发布时间:2014/1/18 14:10:38 -- 3.1版已经增加了INI文本文件的读写函数,你可以直接使用这个来操作了
参考 http://www.weistock.com/bbs/dispbbs.asp?boardid=2&Id=59406 [此贴子已经被作者于2014/1/18 14:10:47编辑过]
|
-- 作者:pel46585 -- 发布时间:2014/1/24 13:16:14 -- Sub WriteTxt()
Set WSHShell = CreateObject("WScript.Shell")
DesktopPath = WSHShell.SpecialFolders("Desktop")
xFile = DesktopPath & "\\config.txt"
MyTxt = Application.AppPath & " 文件创建时间 " & Now()
Set fso = CreateObject("scripting.FileSystemObject") \'绑定fso对象
Set MyFile = fso.CreateTextFile(xFile, True)
MyFile.WriteLine (MyTxt)
MyFile.Close
Set MyFile = Nothing
Set fso = Nothing End Sub Sub ReadTxt()
Set WSHShell = CreateObject("WScript.Shell")
DesktopPath = WSHShell.SpecialFolders("Desktop")
xFile = DesktopPath & "\\config.txt"
Set fso = CreateObject("scripting.FileSystemObject") \'绑定fso对象
Set MyFile = fso.openTextFile(xFile, 1, True) \'用.open方法打开文件
Do Until MyFile.AtEndOfStream
strLine = MyFile.ReadLine
application.MsgOut strLine
Loop
MyFile.Close
Set MyFile = Nothing
Set fso = Nothing End Sub
|
-- 作者:deni977 -- 发布时间:2014/1/25 12:12:57 -- 请问楼上这个是在自定义函数里面实现吗? |