Précédent   Forum des professionnels en informatique > Logiciels > Microsoft Office > Word > VBA Word
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 19/03/2011, 23h07   #1
Candidat au titre de Membre du Club
 
Inscription : février 2006
Messages : 171
Détails du profil
Informations forums :
Inscription : février 2006
Messages : 171
Points : 12
Points : 12
Par défaut inserer un tableau dans une cellule en vbscript word

ci joint mon code dans la cellule 7 je dois faire un tableau de 4 cellule je bloque comment fais t'on ça merci
Code :
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
 
 
With App
Set objDoc = .Documents.Open(modele)
.Visible = False
 
 
Set objRange = objDoc.Range()
objDoc.Tables.Add objRange,7,1
 
Set objTable = objDoc.Tables(1)
'objTable.Range.Font.Size = 18
objTable.Range.Font.Bold = True
objTable.ApplyStyleHeadingRows = True
objTable.ApplyStyleLastRow = False
objTable.ApplyStyleFirstColumn = True
objTable.ApplyStyleLastColumn = False
objTable.ApplyStyleRowBands = True
objTable.ApplyStyleColumnBands = False
objTable.Borders(wdBorderTop).LineStyle = wdLineStyleSingle
objTable.Borders(wdBorderLeft).LineStyle = wdLineStyleSingle
objTable.Borders(wdBorderBottom).LineStyle = wdLineStyleSingle
objTable.Borders(wdBorderRight).LineStyle = wdLineStyleSingle
    'Selection.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleSingle
    'Selection.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleSingle
 
'objTable.Cell(1, 1).Range.Text = "Feuille de route du " + date_tirage
With objTable.Cell(1, 1).Range
.Font.Size = 18
.Text = "Feuille de route du " & date_tirage & vbCrLf & "LE JOURNAL"
.Borders(wdBorderBottom).LineStyle =wdLineStyleSingle
End With
With objTable.Cell(2, 1).Range
.Borders(wdBorderTop).LineStyle = wdLineStyleSingle
.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
.Borders(wdBorderBottom).LineStyle = wdLineStyleSingle
.Borders(wdBorderRight).LineStyle = wdLineStyleNone
End With
With objTable.Cell(3, 1).Range
.Font.Size = 14
.Borders(wdBorderBottom).LineStyle =wdLineStyleSingle
.Text="PORTEUR :" & porteur & "  " & nom_porteur & vbCrLf & "TOURNEE :" & tournee & "  "  & nom_tournee & vbCrLf & " ILOT :  " & ilot & " "  & nom_ilot
End With
 
With objTable.Cell(4, 1).Range
.Borders(wdBorderTop).LineStyle = wdLineStyleSingle
.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
.Borders(wdBorderBottom).LineStyle = wdLineStyleSingle
.Borders(wdBorderRight).LineStyle = wdLineStyleNone
End With
 
With objTable.Cell(5, 1).Range
.Font.Size = 18
.Borders(wdBorderBottom).LineStyle =wdLineStyleSingle
.Text="NOMBRE DE JOURNEAUX A LIVRER     " & nbre_journeaux
End With
 
With objTable.Cell(6, 1).Range
.Borders(wdBorderTop).LineStyle = wdLineStyleSingle
.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
.Borders(wdBorderBottom).LineStyle = wdLineStyleSingle
.Borders(wdBorderRight).LineStyle = wdLineStyleNone
End With
 
 
With objTable.Cell(7, 1).Range
 
 
 
End With
battit64 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/03/2011, 09h19   #2
Responsable Word

 
Avatar de Heureux-oli
 
Homme Olivier Lebeau
Contrôleur d'industrie
Inscription : février 2006
Messages : 17 321
Détails du profil
Informations personnelles :
Nom : Homme Olivier Lebeau
Âge : 47
Localisation : Belgique

Informations professionnelles :
Activité : Contrôleur d'industrie
Secteur : Aéronautique - Marine - Espace - Armement

Informations forums :
Inscription : février 2006
Messages : 17 321
Points : 29 220
Points : 29 220
Salut,

Tu dois insérer ta table sur un range plus petit que toute la table, tu dois en fait adresser la celulle qui va contenir ta seconde table.

Code :
ActiveDocument.Tables.Add Range:=ActiveDocument.Tables(1).Cell(3, 3).Range, numrows:=1, numcolumns:=3
__________________
J'ai pas encore de décodeur, alors, postez en clair ! Comment mettre une balise de code ?
Débutez en VBA

Mes articles


Dans un MP, vous pouvez me dire que je suis beau, ... mais si c'est une question technique je ne la lis pas ! Vous êtes prévenus !
Heureux-oli est actuellement connecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/03/2011, 11h28   #3
Candidat au titre de Membre du Club
 
Inscription : février 2006
Messages : 171
Détails du profil
Informations forums :
Inscription : février 2006
Messages : 171
Points : 12
Points : 12
concretement dans mon code cela donnerait quoi, comprends pas
battit64 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/03/2011, 20h21   #4
Responsable Word

 
Avatar de Heureux-oli
 
Homme Olivier Lebeau
Contrôleur d'industrie
Inscription : février 2006
Messages : 17 321
Détails du profil
Informations personnelles :
Nom : Homme Olivier Lebeau
Âge : 47
Localisation : Belgique

Informations professionnelles :
Activité : Contrôleur d'industrie
Secteur : Aéronautique - Marine - Espace - Armement

Informations forums :
Inscription : février 2006
Messages : 17 321
Points : 29 220
Points : 29 220
Salut,


Tu as essayé où ?
__________________
J'ai pas encore de décodeur, alors, postez en clair ! Comment mettre une balise de code ?
Débutez en VBA

Mes articles


Dans un MP, vous pouvez me dire que je suis beau, ... mais si c'est une question technique je ne la lis pas ! Vous êtes prévenus !
Heureux-oli est actuellement connecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 20h10.


 
 
 
 
Partenaires

Hébergement Web