Consulting

Results 1 to 2 of 2

Thread: Copy Excel diagram to existing PPT

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Question Copy Excel diagram to existing PPT

    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.

    Run-time error '-2147467259 (80004005)': Method 'Open' of object 'Presentations' failed
    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?

    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
    Attached Files Attached Files

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •