Sub Demo() Dim matable As Table Set matable = ActiveDocument.Tables.Add(Selection.Range, NumRows:=3, NumColumns:=3) With matable.Range .Cells(1).Range.Text = .Cells(1).NestingLevel 'definit le niveau de la cellule avant imbrication With .Cells(1) .Tables.Add .Range, 3, 3 'creation de la table imbriquée End With End With End Sub
.Tables.Add Selection.Range, 3, 3, , wdAutoFitContent 'creation de la table imbriquée
With docWord.Tables(numLastTab).Cell(2, 3).Range 'On saute deux lignes .InsertAfter Chr(10) 'definit le niveau de la cellule avant imbrication .Cells(1).Range.InsertAfter .Cells(1).NestingLevel With .Cells(1) 'on ce place en fin de cellule .Range.Select Selection.EndOf (wdCell) 'On crée la table .Tables.Add Range:=appWord.Selection.Range, NumRows:=3, NumColumns:=3 'creation de la table imbriquée End With End With
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questiondocWord.Tables(numtabOVVlisting).Cell(1, 1).Range.Text = "test1"
docWord.Tables.Add Range:=docWord.Tables(numtabOVVlist).Cell(1, 1).Range, NumRows:=3, NumColumns:=6
docWord.Tables.Add Range:=docWord.Tables(numtabOVVlist).Cell(1, 1).Range, NumRows:=3, NumColumns:=6 'On récupère le numéro du tableau précédemment crée dans la cellule Cell(1, 1) numtabOVV = docWord.Tables(numtabOVVlist).Tables.Count 'On donne un thème au tableau With docWord.Tables(numtabOVVlist).Tables(numtabOVV) 'on définit le style du tableau .Style = ("Grille du tableau") End With 'On écrit dans le tableau contenu dans la cellule docWord.Tables(numtabOVVlisting).Cell(1, 1).Tables(numtabOVV).Cell(1, 1).Range.Text = "test1" docWord.Tables(numtabOVVlisting).Cell(1, 1).Tables(numtabOVV).Cell(1, 2).Range.Text = "test12" docWord.Tables(numtabOVVlisting).Cell(1, 1).Tables(numtabOVV).Cell(2, 1).Range.Text = "test2" docWord.Tables(numtabOVVlisting).Cell(1, 1).Tables(numtabOVV).Cell(3, 1).Range.Text = "test3"
'On écrit les "quelques lignes" dans la cellule avant d'insérer le tableau docWord.Tables(numLastTab).Cell(2, 3).Range.InsertAfter "DATE" docWord.Tables(numLastTab).Cell(2, 3).Range.InsertAfter Chr(13) docWord.Tables(numLastTab).Cell(2, 3).Range.InsertAfter "TEST MEANS" docWord.Tables(numLastTab).Cell(2, 3).Range.InsertAfter Chr(13) docWord.Tables(numLastTab).Cell(2, 3).Range.InsertAfter "STATUS" docWord.Tables(numLastTab).Cell(2, 3).Range.Font.Bold = False '************************************************ 'CREATION TABLEAU DANS TABLEAU******************* '************************************************ with docWord.Tables(numLastTab).Cell(2, 3).Range 'On saute deux lignes .InsertAfter Chr(10) .InsertParagraphAfter 'definit le niveau de la cellule avant imbrication .Cells(1).Range.InsertAfter .Cells(1).NestingLevel With .Cells(1) 'On crée la table ET C'EST A CE MOMENT LA QUE MON CONTENU DISPARAIT .Tables.Add .Range, 3, 3, , wdAutoFitContent 'creation de la table imbriquée End With End With numtabOVV = docWord.Tables(numLastTab).Tables.Count 'On donne un thème au tableau With docWord.Tables(numLastTab).Tables(numtabOVV) 'on définit le style du tableau .Style = ("Grille du tableau") End With docWord.Tables(numLastTab).Cell(2, 3).Tables(numtabOVV).Cell(1, 1).Range.Text = "test1" docWord.Tables(numLastTab).Cell(2, 3).Tables(numtabOVV).Cell(1, 2).Range.Text = "test12" docWord.Tables(numLastTab).Cell(2, 3).Tables(numtabOVV).Cell(2, 1).Range.Text = "test2" docWord.Tables(numLastTab).Cell(2, 3).Tables(numtabOVV).Cell(3, 1).Range.Text = "test3"
'On écrit les "quelques lignes" dans la cellule avant d'insérer le tableau docWord.Tables(numLastTab).Cell(2, 3).Range.InsertAfter "DATE" docWord.Tables(numLastTab).Cell(2, 3).Range.InsertAfter Chr(13) docWord.Tables(numLastTab).Cell(2, 3).Range.InsertAfter "TEST MEANS" docWord.Tables(numLastTab).Cell(2, 3).Range.InsertAfter Chr(13) docWord.Tables(numLastTab).Cell(2, 3).Range.InsertAfter "STATUS" docWord.Tables(numLastTab).Cell(2, 3).Range.Font.Bold = False '************************************************ 'CREATION TABLEAU DANS TABLEAU******************* '************************************************ With docWord.Tables(numLastTab).Cell(2, 3).Range 'On saute deux lignes .InsertAfter Chr(10) 'definit le niveau de la cellule avant imbrication .Cells(1).Range.InsertAfter .Cells(1).NestingLevel With .Cells(1) 'On crée la table .Tables.Add Range:=appWord.Selection.Range, NumRows:=3, NumColumns:=3 'creation de la table imbriquée End With End With numtabOVV = docWord.Tables(numLastTab).Tables.Count 'On donne un thème au tableau With docWord.Tables(numLastTab).Tables(numtabOVV) 'on définit le style du tableau .Style = ("Grille du tableau") End With