import excel to access database in vb6.00 - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

import excel to access database in vb6.00

can anyone help me with the code.
am trying to import the content of an excel sheet to my access database using common dialog in vb6. i tried this code below but is not working ........

Private Sub sLoadExcel()
If CommonDialog1.FileName = "" Then Exit Sub
Dim exc As Object
Set exc = CreateObject("Excel.Application")
exc.Workbooks.Add (CommonDialog1.FileName)
exc.Visible = True

'Dim i As Integer
For i = 0 To exc.Row - 1
With rstAS400
.Fields![STUDID] = exc.cells(i, 1)
.Fields![FNAME] = exc.cells(i, 2)
.Fields![LNAMSE] = exc.cells(i, 3)
.Fields![SEX] = exc.cells(i, 4)
.Fields![LDOB] = exc.cells(i, 5)
Next i
End With
End Sub

please help me out.
Sign In or Register to comment.