Si vous recevez le message Erreur 5992 dans Word 2003 en essayant d'accéder à une colonne d'une table, vous pouvez essayer les choses suivantes.
Voici le cas qui me causait l'erreur :
A première vue, les colonnes de la table ont la même largeur.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 For Each myTable In ActiveDocument.Tables myTable.Select ' Cette ligne cause l'erreur For Each myCol In myTable.Columns For Each myCell In myCol.Cells myCell.Select ... << Votre code ...>> Next myCell Next myCol Next myTable
J'ai constaté que si la macro est exécutée en mode norma (View Normal), et pas vue pour l'impression, l'erreur ne se produit pas.
Pour information, la solution trouvée sur un forum de Microsoft
(http://www.microsoft.com/communities...&cr=&sloc=&p=1)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 Sub Test699() Dim oRow As Row Dim oTbl As Table Set oTbl = ActiveDocument.Tables(1) With oTbl For Each oRow In oTbl.Range.Rows oRow.Cells(1).Width = InchesToPoints(1) oRow.Cells(2).Width = InchesToPoints(5.5) Next End With End Sub
Partager