By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,806 Members | 1,457 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,806 IT Pros & Developers. It's quick & easy.

how to use command button to load excel file from the listfile and then dispay it

P: 3
hello
for your imformation im using Vb6 and having difficulties on loading a file and then displayed the file. for your information i uses a combox,listview ,directory view and also command buttons for my program.i am having the difficulities on loading the data using my load button and than display the data.if i want to load an excel data and then display the data, how shoule i program it.pls help me.

Private Sub cboPattern_Change()
Dim pos1 As Integer
Dim pos2 As Integer
Dim txt As String

txt = cboPattern.Text
pos1 = InStrRev(txt, "(")
pos2 = InStrRev(txt, ")")
filList.Pattern = Mid$(txt, pos1 + 1, pos2 - pos1 - 1)
End Sub

Private Sub cmdCancel_Click()
Me.Hide
End Sub

Private Sub cmdOk_Click()
' We did not cancel.
Canceled = False
FilePath = filList.Path
FileName = filList.FileName




End Sub


Private Sub dirList_Change()
filList.Path = dirList.Path
End Sub

Private Sub drvList_Change()
'On Error GoTo DriveError
dirList.Path = drvList.Drive
Exit Sub

DriveError:
drvList.Drive = dirList.Path
Exit Sub
End Sub



Private Sub Form_Load()
' Assume we will cancel.
Canceled = True
FileName = ""
FilePath = ""

cboPattern.AddItem "All Files (*.*)"
cboPattern.AddItem "Text Files (*.txt)"
cboPattern.AddItem "Excel Files (*.xls)"
cboPattern.AddItem "Bitmap Files (*.bmp)"
cboPattern.AddItem "VB Files (*.frm;*.frx;*.vbp;*.vbw)"

cboPattern.ListIndex = 0
End Sub
Sep 7 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.