+ Reply to Thread
Results 1 to 2 of 2

Pasting Graph to Powerpoint

  1. #1
    Registered User
    Join Date
    02-16-2012
    Location
    sa
    MS-Off Ver
    Excel 2007
    Posts
    80

    Pasting Graph to Powerpoint

    Good day,

    I am using the following code to paste excel generated graphs into a powerpoint presentation

    Sub Chart2PPT()
    Dim objPPT As Object
    Dim objPrs As Object
    Dim shtTemp As Worksheet
    Dim chtTemp As ChartObject
    Dim intSlide As Integer

    intSlide = 1

    Set objPPT = CreateObject("Powerpoint.application")
    objPPT.Visible = True
    objPPT.presentations.Open Filename:="filename.pptx"

    'objPPT.ActiveWindow.ViewType = 1 'ppViewSlide

    For Each shtTemp In ThisWorkbook.Worksheets
    For Each chtTemp In shtTemp.ChartObjects
    intSlide = intSlide + 1
    chtTemp.CopyPicture
    If intSlide > objPPT.presentations(1).Slides.Count Then
    objPPT.ActiveWindow.View.GotoSlide Index:=objPPT.presentations(1).Slides.Add(Index:=intSlide, Layout:=1).SlideIndex
    Else
    objPPT.ActiveWindow.View.GotoSlide intSlide
    End If

    objPPT.ActiveWindow.View.Paste
    Next
    Next
    ' objPPT.presentations(1).Save
    ' objPPT.Quit


    Set objPrs = Nothing
    Set objPPT = Nothing
    End Sub

    I would like to run this code on a weekly basis and have the graphs update with the latest graphs instead of just pasting on top of the old ones. what code can I use to clear the previous old graph before pasting the new graphs

    thanks

  2. #2
    Registered User
    Join Date
    02-16-2012
    Location
    sa
    MS-Off Ver
    Excel 2007
    Posts
    80

    Re: Pasting Graph to Powerpoint

    I would also like to save the ppt with a new file name and date stamp

    Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Pasting Excel Graph into Powerpoint
    By cpadude in forum Excel General
    Replies: 2
    Last Post: 04-19-2008, 09:10 AM
  2. Pasting from Excel to Powerpoint
    By Jim Jackson in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-21-2006, 08:35 AM
  3. Powerpoint Graph- Shading in between two linear graph lines
    By TerenYoung in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 06-15-2006, 04:35 AM
  4. [SOLVED] pasting to powerpoint
    By finance geek in forum Excel General
    Replies: 1
    Last Post: 04-21-2006, 02:00 AM
  5. Pasting Charts from Excel to PowerPoint
    By Willow in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-14-2006, 10:30 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1