2011-08-04 62 views

回答

6
Private Sub Command1_Click() 
    'Declare variables. 
    Dim fso As New FileSystemObject 
    Dim ts As TextStream 
    'Open file. 
    Set ts = fso.OpenTextFile(Environ("windir") & "\system.ini") 
    'Loop while not at the end of the file. 
    Do While Not ts.AtEndOfStream 
     Debug.Print ts.ReadLine 
    Loop 
    'Close the file. 
    ts.Close 
    End Sub 

MSDN FSO Object

路更舒服然后Open sPath, #FileNo。您需要使用“工具 - >参考”向您的项目添加FSO,就像在MSDN中描述的那样。

+1

非常感谢:) – VanDeath

+0

@VanDeath欢迎来到Stackoverflow!看看[常见问题](http://stackoverflow.com/faq),你可以通过点击向上箭头来获得有用的答案,甚至接受它。 – Jacob

+0

我不能XD它告诉我我必须有15个声望-.-' – VanDeath