-
June 9th, 2011, 04:34 AM
#1
comapre .xls and .csv in vb6
hi!
can anyone help me with my project? i need to create a program where in i need to compare the invoice# in .xls and in .csv file. in the .xls there are 3 column (customer number, invoice#, date sent) and in .csv there are 10 columns (no header), the invoice# in .csv is located in 3rd column and the status of each invoice is in 2nd column. i need to compare and show the status of each invoice in the .xls file 5th column.
(in .csv) if the status is 1 means accepted, 2- processed, 3- collected.
i only started the interface where in i have 2 txt boxes (1st txt box for .xls and 2nd for .csv), and i added a command button so if i click this the process will start. i dont know how to start the main process, please help me. thanks a lot
-
June 9th, 2011, 10:12 AM
#2
Re: comapre .xls and .csv in vb6
You'd have to read the XLS file, then get the cell needed. Reading the CSV is easier, though.
Post the code that you have tried...
-
June 10th, 2011, 09:52 AM
#3
Re: comapre .xls and .csv in vb6
As idicated above reading the XLS file can be tricky, especially so if you are not used to working with xls files. There are a couple of ways you can do this, one is to use Excel within your program but that will require the user to have Excel installed on thier system. The other is to use an ODBC data source to open the xls as a data fle which is the method I would consider. CSV can be done the same way but CSV is easy to work with directly in VB.
Another option would be to save the xls file as a csv then you are dealing with 2 csv files and your work will be much easier.
show us what you have so far.
Always use [code][/code] tags when posting code.
-
June 13th, 2011, 03:17 AM
#4
Re: comapre .xls and .csv in vb6
thanks for the reply guys, below code were from different resources, and i dont know whats next after this... thank u very much for the help!
Private Sub cmdBrowse1_Click()
CommonDialog1.Filter = "Excel Files | *.xls"
CommonDialog1.ShowOpen
Text1.Text = CommonDialog1.FileName
End Sub
Private Sub cmdBrowse2_Click()
CommonDialog1.Filter = "Comma Separated Values | *.csv"
CommonDialog1.ShowOpen
Text2.Text = CommonDialog1.FileName
End Sub
Private Sub cmdRun_Click()
Dim strFilename As String
Dim irow As Integer
Dim value As Variant
Dim xlApp As New Excel.Application
Dim xlsheet As Excel.Worksheet
Dim xlWrkBk As Excel.Workbook
Set xlApp = New Excel.Application
If Trim(Text1.Text) = "" Or Trim(Text2.Text) = "" Then
MsgBox "Please select file for input!", vbExclamation, "Error"
Exit Sub
End If
ExcelpathS = Trim(Text1.Text)
ExcelpathS = Trim(Text2.Text)
strFilename = GetFileName(ExcelpathS)
Text1.Text = xlsheet.Cells(2, 1) ' row 2 col 1
Text2.Text = xlsheet.Cells(2, 2) ' row 2 col 2
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|