i = sLineStart
j = ColRef2ColNum(sColStart)
sColumnTitle = ""
Do While Len(Range(ColNum2ColRef(j) & i).Formula) > 0
sColumnTitle = sColumnTitle & "`" & Cells(i, j) & "`,"
j = j + 1
Loop
sColumnTitle = Mid(sColumnTitle, 1, Len(sColumnTitle) - 1)
iNumColumn = j
i = i + 1
j = ColRef2ColNum(sColStart)
'Recuperation des données lignes par lignes
If iLineNum > 0 Then
For i = i To i + iLineNum - 1
sSQL = ""
sql = ""
'Recuperation des données de la ligne pour chaque colonne
For j = ColRef2ColNum(sColStart) To iNumColumn - 1
sSQL = sSQL & Cells(i, j) & "','"
Next j
sSQL = Mid(sSQL, 1, Len(sSQL) - 3)
'Break out of function if user hasn't enter any value
If InStr(sSQL, "[please specify]") Then
ExecuteUpdate = True
Exit Function
End If
'Insertion des données dans la table
sql = "INSERT INTO [" & sTableName & "] (" & sColumnTitle & ") values ('" & sSQL & "');"
oConnection.Execute sql
Tracer " OK- Query: " & sql
Next i
|