主頁 > 知識庫 > filesystemobject組件的用法示例

filesystemobject組件的用法示例

熱門標簽:修改地圖標注 武夷山旅游地圖標注 鳳臺百度地圖標注店 外呼系統(tǒng)API接口 金昌電話機器人價格 萊西電子地圖標注 個人可以辦理400電話么 怎么在地圖標注自己 縣域地圖標注打印店
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' CreateLyrics
' 目的:
' 在文件夾中創(chuàng)建兩個文本文件。
' 示范下面的內容
' - FileSystemObject.CreateTextFile
' - TextStream.WriteLine
' - TextStream.Write
' - TextStream.WriteBlankLines
' - TextStream.Close
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Sub CreateLyrics(Folder)

Dim TextStream

Set TextStream = Folder.CreateTextFile("OctopusGarden.txt")

TextStream.Write("Octopus' Garden ") ' 請注意,該語句不添加換行到文件中。
TextStream.WriteLine("(by Ringo Starr)")
TextStream.WriteBlankLines(1)
TextStream.WriteLine("I'd like to be under the sea in an octopus' garden in the shade,")
TextStream.WriteLine("He'd let us in, knows where we've been -- in his octopus' garden in the shade.")
TextStream.WriteBlankLines(2)

TextStream.Close

Set TextStream = Folder.CreateTextFile("BathroomWindow.txt")
TextStream.WriteLine("She Came In Through The Bathroom Window (by Lennon/McCartney)")
TextStream.WriteLine("")
TextStream.WriteLine("She came in through the bathroom window protected by a silver spoon")
TextStream.WriteLine("But now she sucks her thumb and wanders by the banks of her own lagoon")
TextStream.WriteBlankLines(2)
TextStream.Close

End Sub

' GetLyrics
' 目的:
' 顯示 lyrics 文件的內容。
' 示范下面的內容
' - FileSystemObject.OpenTextFile
' - FileSystemObject.GetFile
' - TextStream.ReadAll
' - TextStream.Close
' - File.OpenAsTextStream
' - TextStream.AtEndOfStream
' - TextStream.ReadLine
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Function GetLyrics(FSO)

Dim TextStream
Dim S
Dim File

' 有多種方法可用來打開一個文本文件,和多種方法來從文件讀取數(shù)據(jù)。
' 這兒用了兩種方法來打開文件和讀取文件:

Set TextStream = FSO.OpenTextFile(TestFilePath "\Beatles\OctopusGarden.txt", OpenFileForReading)

S = TextStream.ReadAll NewLine NewLine
TextStream.Close

Set File = FSO.GetFile(TestFilePath "\Beatles\BathroomWindow.txt")
Set TextStream = File.OpenAsTextStream(OpenFileForReading)
Do While Not TextStream.AtEndOfStream
S = S TextStream.ReadLine NewLine
Loop
TextStream.Close

GetLyrics = S

End Function

標簽:上海 邢臺 楚雄 涼山 南京 赤峰 通遼 清遠

巨人網(wǎng)絡通訊聲明:本文標題《filesystemobject組件的用法示例》,本文關鍵詞  filesystemobject,組件,的,用法,;如發(fā)現(xiàn)本文內容存在版權問題,煩請?zhí)峁┫嚓P信息告之我們,我們將及時溝通與處理。本站內容系統(tǒng)采集于網(wǎng)絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《filesystemobject組件的用法示例》相關的同類信息!
  • 本頁收集關于filesystemobject組件的用法示例的相關信息資訊供網(wǎng)民參考!
  • 推薦文章