'FSO的例子 Dim fso, MyFile, thefile, IniFile, retstring If Right(App.Path, 1) = "\" Then IniFile = App.Path & "YourFile" Else IniFile = App.Path & "\YourFile" End If Set fso = CreateObject("Scripting.FileSystemObject") If fso.FileExists(IniFile) = False Then Exit Function End If
Set thefile = fso.OpenTextFile(IniFile, 1, False) Do While thefile.AtEndOfStream <> True retstring = thefile.ReadLine
If InStr(retstring, "<Key>") <> 0 Then Text1.text = Text1.Text & retstring & VBCrlf End If
If Right(App.Path, 1) = "\" Then
IniFile = App.Path & "YourFile"
Else
IniFile = App.Path & "\YourFile"
End If Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(IniFile) = False Then
Exit Function
End If
Set thefile = fso.OpenTextFile(IniFile, 1, False)
Do While thefile.AtEndOfStream <> True
retstring = thefile.ReadLine
If InStr(retstring, "<Key>") <> 0 Then
Text1.text = Text1.Text & retstring & VBCrlf
End If
Loop
thefile.Close