Results 1 to 4 of 4

Thread: Embed an Excel Chart into PowerPoint - VBA

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member
    Join Date
    May 2012
    Posts
    25
    Rep Power
    0

    Question Embed an Excel Chart into PowerPoint - VBA

    Hi,
    I am trying to copy a ChartObject created in a workbook sheet and paste it into a powerpoint 2010 slide, such that it becomes a standalone Excel Chart with data (embedded).

    When i do it manually i.e :

    1. Copy ChartObject present in WorkSheet
    2. Goto Powerpoint Slide
    3. Click PasteSpecial & select "Use Destination Theme & Embed Workbook (H)".
    4. Right-click the ChartObject in Powerpoint & click "Edit Data".


    Then i get a new standalone workbook with Title "Chart in Microsoft Excel", that shows the Chart as well as data. I have not been able to replicate this scenario where i get a new standalone workbook with Title "Chart in Microsoft Excel" using Excel VBA. Can someone help?

    Assuming there is a simple column chart on the sheet, here is the code:

    PHP Code:
    Option Explicit
    Sub doit
    ()
    Dim Temp As Workbook
    Dim Rng 
    As Range
    Dim ChtObj 
    As ChartObject

    With ThisWorkbook
    .Sheets(1)
        
    Set ChtObj = .ChartObjects(1)
        
    With ChtObj
            
    .Copy
        End With

        Dim ppapp 
    As Object
        Dim pppres 
    As Object
        Dim ppslide 
    As Object

        On Error Resume Next
        Set ppapp 
    GetObject(, "Powerpoint.Application")

        If 
    ppapp Is Nothing Then
            Set ppapp 
    CreateObject("Powerpoint.Application")
        
    End If
        
    On Error GoTo 0

        Set pppres 
    ppapp.presentations.Add
        Set ppslide 
    pppres.Slides.Add(112)

        
    With ppapp
            
    .Activate
            
    .Visible msoTrue
            
    .ActiveWindow.viewtype 1
        End With

        ChtObj
    .Copy
        ppapp
    .ActiveWindow.View.Paste

    End With
    End Sub 
    i have tried :

    PHP Code:
    ppslide.Shapes.PasteSpecial(110, , , , 0'11 = ppPasteShape 
    OR

    PHP Code:
    ppslide.Shapes.PasteSpecial 100, , , , '10 = ppPasteOLEObject 
    OR

    PHP Code:
    ppapp.ActiveWindow.View.PasteSpecial 100, , , , 
    but it did not help!
    Last edited by Junoon; 07-11-2013 at 11:03 PM. Reason: PHP TAGS USED

Similar Threads

  1. Copy/Paste Excel Range/Chart into Powerpoint VBA
    By Admin in forum Excel and VBA Tips and Tricks
    Replies: 1
    Last Post: 03-13-2014, 02:59 PM
  2. Add VBA Reference From Another Application Excel To PowerPoint
    By ds1001 in forum Rajan Verma's Corner
    Replies: 1
    Last Post: 06-02-2013, 02:43 PM
  3. Replies: 2
    Last Post: 04-14-2013, 08:23 PM
  4. Replies: 1
    Last Post: 05-20-2012, 12:23 PM
  5. Saving Embedded Picture From Excel Workbook Sheet To Folder Hard Drive
    By littleiitin in forum Excel and VBA Tips and Tricks
    Replies: 0
    Last Post: 10-31-2011, 02:31 PM

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
  •