1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| Dim myrange As Range
Dim objTable As Table
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("Monthly Groundwater Chem Update_TE")
Dim nb_col As Long
Dim nb_lignes As Long
nb_col = rst.Fields.Count
nb_lignes = rst.RecordCount
'MsgBox nb_col & " " & nb_lignes
Set objTable = Word_ajoute_tableau(nb_col, nb_lignes + 1)
objTable.AllowPageBreaks = True
Dim cpt_lig As Integer
Dim cpt_col As Integer
cpt_lig = 0
cpt_col = 0
While cpt_col < nb_col
objTable.Cell(cpt_lig + 1, cpt_col + 1).Range.Text = rst(cpt_col).name
objTable.Cell(cpt_lig + 1, cpt_col + 1).Range.Bold = True
cpt_col = cpt_col + 1
Wend
cpt_col = 0
While cpt_lig < nb_lignes
While cpt_col < nb_col
objTable.Cell(cpt_lig + 2, cpt_col + 1).Range.Text = rst(cpt_col)
cpt_col = cpt_col + 1
Wend
rst.MoveNext
cpt_col = 0
cpt_lig = cpt_lig + 1
Wend
rst.Close
Word_Suppression_Lien_OLE |
Partager