bisa juga file excel nya di simpan/ditarik dulu MSFlexGridList,
nah dari situ baru dech di simpan ke database.
'--------------------------------------------
Dim X As Integer
Dim xlsApp As Excel.Application
Dim book As Excel.Workbook
Dim sheet As Excel.Worksheet
Dim Pat

Set xlsApp = New Excel.Application
xlsApp.Visible = False

CmDialog.DialogTitle = "Open file"
    CmDialog.CancelError = True
    CmDialog.InitDir = "C:\"
    CmDialog.Filter = "Excel file (*.xls)|*.xls"
    
    CmDialog.ShowOpen
   
    Pat = CmDialog.FileName
Set book = xlsApp.Workbooks.Open(Pat)

Set sheet = book.Worksheets(1)  'Sheet 1
'n = sheet.Rows

Me.MSFlexGridList.Rows = n + 1

'Loop through cells to get data and modify data if you want to

For X = 1 To d

MSFlexGridList.TextMatrix(X, 1) = sheet.Cells(X + 1, 1)
MSFlexGridList.TextMatrix(X, 2) = sheet.Cells(X + 1, 2)
MSFlexGridList.TextMatrix(X, 3) = sheet.Cells(X + 1, 3)
MSFlexGridList.TextMatrix(X, 4) = sheet.Cells(X + 1, 4)
MSFlexGridList.TextMatrix(X, 5) = sheet.Cells(X + 1, 5)
MSFlexGridList.TextMatrix(X, 6) = sheet.Cells(X + 1, 6)
MSFlexGridList.TextMatrix(X, 7) = sheet.Cells(X + 1, 7)
MSFlexGridList.TextMatrix(X, 8) = sheet.Cells(X + 1, 8)
MSFlexGridList.TextMatrix(X, 9) = sheet.Cells(X + 1, 9)

Next X
book.Close False     'Or True if you want to save changes
xlsApp.Quit
Set xlsApp = Nothing
Set book = Nothing
Set sheet = Nothing
'--------------------------------------------
Semoga aja Membantu


gunartha.nyoman wrote:
>
> gimana kalau pake trik sedikit,
> file excel nya di link dulu ke ms access kemudian baru di import ke db
> yg dimaksud ( spt : sql server, ato postgres)
> saya pakai cara ini bisa
> semoga membantu
>
> Fatma Sari wrote:
> > Dear All...
> >
> > Ada yang punya coding VB6 untuk import excel 2003 ke database gak?
> > dari kemarin dah nyari di google gak dapat2 nih...:(
> > Ada yang bisa bantu gak?
> >
> >
> > Thanks before
> >
> >
> >
> >
> >
>
> 

Kirim email ke