如何讀取TXT文件內(nèi)容? [金字塔]
- 咨詢內(nèi)容:
我們知道,在后臺,可以用debugfile將變量輸出到文件,反過來,要將TXT文件中的一個數(shù)值,如何讀取到金字塔后臺的變量中?深度請教!
- 金字塔客服:
3.1版已經(jīng)增加了INI文本文件的讀寫函數(shù),你可以直接使用這個來操作了
參考
http://www.weistock.com/bbs/dispbbs.asp?boardid=2&Id=59406
[此貼子已經(jīng)被作者于2014/1/18 14:10:47編輯過] - 用戶回復(fù):
Sub WriteTxt()
Set WSHShell = CreateObject("WScript.Shell")
DesktopPath = WSHShell.SpecialFolders("Desktop")
xFile = DesktopPath & "\config.txt"
MyTxt = Application.AppPath & " 文件創(chuàng)建時間 " & Now()
Set fso = CreateObject("scripting.FileSystemObject") '綁定fso對象
Set MyFile = fso.CreateTextFile(xFile, True)
MyFile.WriteLine (MyTxt)
MyFile.Close
Set MyFile = Nothing
Set fso = NothingEnd SubSub 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 = NothingEnd Sub
- 網(wǎng)友回復(fù): 請問樓上這個是在自定義函數(shù)里面實(shí)現(xiàn)嗎?
有思路,想編寫各種指標(biāo)公式,程序化交易模型,選股公式,預(yù)警公式的朋友
可聯(lián)系技術(shù)人員 QQ: 511411198 進(jìn)行 有償 編寫!(不貴!點(diǎn)擊查看價格!)
相關(guān)文章
-
沒有相關(guān)內(nèi)容