Option Explicit
Private Sub Command1_Click()
'***BE SURE TO REFERENCE MICROSOFT SCRIPTING RUNTIME UNDER
'***UNDER PROJECT > REFERENCES
'''''''''''''''''''''''''''''''
Dim mFileSysObj As Scripting.FileSystemObject ' General declaration
Dim mFile As Scripting.File ' General declaration
Dim mTextStream As Scripting.TextStream
'Instantiating the object variable mFileSysObj
Set mFileSysObj = New Scripting.FileSystemObject
' Get the file
Set mFile = mFileSysObj.GetFile(App.Path & "\" & Trim("a.Txt"))
' Open a text stream for reading from a file
Set mTextStream = mFile.OpenAsTextStream(ForReading)
'reading data from file as long as it is not the end of file
While Not mTextStream.AtEndOfStream
' Read the data
Combo1.AddItem (mTextStream.ReadLine)
If (mTextStream.Line = 5) Then
mTextStream.SkipLine
End If
'Parse the string as ',' as delimiter
' strArray = Split(strData, ",")
Wend
Call mTextStream.Close ' Close the text stream
End Sub
Private Sub Form_Load()
'setting the dialog path, the drive and the directory to the same path as the
'application
' dlgFile.InitDir = App.Path
ChDrive App.Path
ChDir App.Path
End Sub