Hello everyone
I want to copy an Excel diagram "MyDiagram" from the Excel file "MyExcel" with VBA into the PPT file "MyPowerPoint". However, if a diagram with the same name already exists, it should only be replaced so that there are not 2 same diagrams in the Powerpoint.
Problem:
Unfortunately, when I try to open "MyPowerpoint" (same file path as "MyExcel"), I get the following error.
PS: my whole computer is synchronized with OneDrive, which is why I have already received the error message that the file name must not contain more than 255 characters. Workaround?Run-time error '-2147467259 (80004005)': Method 'Open' of object 'Presentations' failed
Here is my code in Module 1 to open existing powerpoint:
Option Explicit Sub UpdateChartPPT() Dim pptpath As String Dim PP As Object Dim PPpres As Object pptpath = CurDir & "MyPowerpoint.pptx" MsgBox pptpath Set PP = CreateObject("PowerPoint.Application") Set PPpres = PP.Presentations.Open(pptpath) PP.Visible = msoCTrue End Sub