Bonjour à tous,
Sous Windows XP et Excel 2007, configuration de création, la macro ci-dessous effectue bien la mise à jour des graphes Powerpoint.
Sous Windows 10 et Excel 2007 ou Excel 2019, j'obtiens une erreur de compilation sur le mot chart:
Membre de méthode ou de données introuvable.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Option Explicit
Dim FEUILLE_PARAMETRE
Dim strPresPath, strNewPresPath
'CLASSEUR ET PPT
Public monclasseur
Public oPPTApp As PowerPoint.Application
Public oPPTFile As PowerPoint.Presentation, oPPTFile_in As PowerPoint.Presentation
'
Public slidenum
Sub GLOBAL_MAJ()
Call OUVERTURE_PPT
Call MAJ_GRAPHE
oPPTFile.SaveAs strNewPresPath
oPPTFile.Close
oPPTApp.Quit
'
Set oPPTFile_in = Nothing
Set oPPTFile = Nothing
Set oPPTApp = Nothing
Set monclasseur = Nothing
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub MAJ_GRAPHE()
Dim i
Dim cell_start, v_temp
Dim ShapeName
Dim i_line_debut, j_col_debut, j_col, i_line
slidenum = 1
ShapeName = "QUESTION1"
cell_start = "G3"
Range(cell_start).Select
i_line_debut = ActiveCell.Row
j_col_debut = ActiveCell.Column
'
j_col = j_col_debut
i_line = i_line_debut
With oPPTFile.Slides(slidenum).Shapes(ShapeName)
' ERREUR DE COMPILATION
.Chart.ChartData.Activate
For i = 1 To 2
v_temp = monclasseur.Sheets(FEUILLE_PARAMETRE).Cells(i_line, j_col).Value
.Chart.ChartData.Workbook.Worksheets("Feuil1").Cells(i + 1, 2).Value = v_temp
j_col = j_col + 1
Next i
'
.Chart.ChartData.Workbook.Close
'
End With
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub OUVERTURE_PPT()
Dim FileIN, FileOUT
Application.ScreenUpdating = False
Set monclasseur = Application.ActiveWorkbook
FEUILLE_PARAMETRE = "PARAMETRE"
FileIN = monclasseur.Sheets(FEUILLE_PARAMETRE).Range("C3").Value
FileOUT = monclasseur.Sheets(FEUILLE_PARAMETRE).Range("C4").Value
' Présentation PPT contenant un graphe à mettre à jour
strPresPath = ThisWorkbook.Path & "" & FileIN
strNewPresPath = ThisWorkbook.Path & "" & FileOUT
Set oPPTApp = CreateObject("PowerPoint.Application")
oPPTApp.Visible = msoTrue
Set oPPTFile_in = oPPTApp.Presentations.Open(strPresPath)
oPPTFile_in.SaveAs strNewPresPath
Set oPPTFile = oPPTApp.ActivePresentation
Set oPPTFile_in = Nothing
'
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Je cherche une solution à ce problème depuis 2015.
Si quelqu'un a déjà eu ce problème et a trouvé une solution,
cela éviterait de mettre tous ces projets basés sur ce mécanisme à la poubelle.
D'avance merci