看板 Visual_Basic 關於我們 聯絡資訊
雖然我也很習慣這種老寫法,一般而言這也沒什麼不好,反正都可以完成任務 但是建議你改用 filesystemobject / textstream 這種現代一點的寫法 將來轉到ASP或*.NET上面的時候才比較好適應 不要只會這個open;那至少有20年歷史,都快老掉牙了 而且到*.NET就不能用了 以下是VBA上的例子。 Set fshandle = CreateObject("scripting.fileSystemObject") Set infile = fshandle.getfile("d:\lng\prog\data.txt") ' 先用fso打開檔案 Set instream = infile.openAsTextStream() ' 然後把檔案開成ts Do ... infLine = instream.readline ' 這裡讀出來的 infLine 就是字串了。 ... Loop Until instream.atendofstream fileSystemObject還有readAll等等方便的功能, 你可以整個檔案讀出來就丟進textbox裡去,不用一行一行讀。 其他功能你可以參閱office VBA help中fileSystemObject的項目。   -- BATCH 1 (4/20) - 如何隱身 - SPAM - 英國殺人笑話 - http://tinyurl.com/65vvbx BATCH 2 (5/10) - 當眾脫褲 - 主教 - 傻蛋奧運會 - http://tinyurl.com/68grk7 BATCH 3 (6/14) - 買張床 - 切達大俠 - 伐木人之歌 - http://tinyurl.com/3zpyx5 ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ 蒙帝派松正體中文計畫 Spam-a-lot and enjoy the pythonesque delight! ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.115.217.248