Bonsoit a tous!
J'utilise un code qui genere 105 graphes excel puis envoie les graphes dans word avant de les effacer d'excel.
Deux problème apparaissent:
1) le code plante après avoir crée le 30eme graph!!! bizarre
2) lors de l'exécution du code il m'affiche les graphes en construction dans exel cela ralenti énormément le code !!! bizarre
Existe-t-il une solution????
Merci d'avance
Bonjour
Ce serait plus simple avec ton code
Ci dessous le code
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Sub Macro1() ' ' Macro1 Macro ' Dim wrd As Object Dim vPlage As Range Dim vnom As Range Dim tnom As Range Dim mnom As Range Set wrd = CreateObject("Word.Application") wrd.Documents.Open ("C:\Users\kad\Desktop\doc.docx") For i = 10 To 12 Set vPlage = Worksheets("synthese").Range("D9:G9,D" & i & ":G" & i) Set vgraphique = ThisWorkbook.Charts.Add With vgraphique .SetSourceData Source:=vPlage, PlotBy:=xlRows .ChartType = xlColumnClustered .HasTitle = True .ChartTitle.Text = "Bilan des compétences" .ChartTitle.Font.Size = 14 .ChartTitle.Font.Bold = True .PlotArea.Width = 500 .PlotArea.Height = 300 .PlotArea.Top = 45 .PlotArea.Left = 70 .Location where:=xlLocationAsObject, Name:="synthese" End With Set vnom = Worksheets("synthese").Range("B" & i) Set tnom = Worksheets("synthese").Range("C" & i) Set mnom = Worksheets("synthese").Range("A" & i) With ActiveChart .Shapes.AddTextbox(msoTextOrientationHorizontal, _ 250, 400, 100, 60) _ .TextFrame.Characters.Text = vnom & " " & tnom & " " & mnom .Axes(xlValue).MinimumScale = 0 .Axes(xlValue).MaximumScale = 1 .Legend.Delete .Shapes.AddTextbox(msoTextOrientationHorizontal, _ 10, 700, 210, 70) _ .TextFrame.Characters _ .Text = "PDS : Pratiquer une démarche scientifique MOM : Maîtriser les outils mathématiques MLF : Maîtriser la langue francaise EXP : Expérience MCS : Maîtriser les connaissances scientifiques" .Shapes(2).TextFrame.Characters.Font.Size = 10 .ChartArea.Copy End With With wrd .Selection.PasteAndFormat (wdChartPicture) .Selection.TypeParagraph .Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter End With Next i For Each Legraph In ActiveSheet.ChartObjects Legraph.Delete Next End Sub
Partager