+ Reply to Thread
Results 1 to 2 of 2

Copying Chart to Specific PowerPoint Slide

  1. #1
    Registered User
    Join Date
    03-10-2013
    Location
    Mukilteo, WA
    MS-Off Ver
    Excel 2007
    Posts
    29

    Copying Chart to Specific PowerPoint Slide

    I am building a macro that will copy a selection of data based on the date entered, pull up an existing, saved powerpoint, and paste that chart into the second slide of the powerpoint. So far, my macro will select and copy the proper chunk of data and open the correct powerpoint. It breaks at the commands to select the second slide and returns "runtime error "91" Object variable or With block variable not set. I am attaching the file here hoping that it will make helping me easier.

    Here's the current code:


    'Works for February Tab
    Sub CreateStaffTemplate()
    With Worksheets("Feb")
    Select Case .Range("C20").Value
    Case .Range("B4").Value: .Range("B6:D15").CopyPicture Appearance:=xlScreen, Format:=xlPicture
    Case .Range("F4").Value: .Range("F6:H15").Copy
    Case .Range("J4").Value: .Range("J6:L15").Copy
    Case .Range("N4").Value: .Range("N6:P15").Copy
    End Select
    End With

    Dim PPT As PowerPoint.Application
    Dim myShapeRange As PowerPoint.Shape
    Dim myPresentation As PowerPoint.Presentation
    Dim ppSlide As PowerPoint.Slide
    Dim SlideNum As Integer
    Set PPT = New PowerPoint.Application
    PPT.Visible = True
    PPT.Presentations.Open Filename:="C:\Users\vk307d\Desktop\Staff Meeting Template.pptm"
    PPT.Activate
    Set PPT = GetObject(, "Powerpoint.Application")
    myPresentation.Slides(2).Shapes.Paste
    Attached Files Attached Files
    Last edited by HabsFan89; 02-09-2015 at 02:04 PM.

  2. #2
    Registered User
    Join Date
    03-10-2013
    Location
    Mukilteo, WA
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Copying Chart to Specific PowerPoint Slide

    Solved my own problem - here's the appropriate code:

    'Works for February Tab
    Sub CreateStaffTemplate()
    With Worksheets("Feb")
    Select Case .Range("C20").Value
    Case .Range("B4").Value: .Range("B6:D15").Copy
    Case .Range("F4").Value: .Range("F6:H15").Copy
    Case .Range("J4").Value: .Range("J6:L15").Copy
    Case .Range("N4").Value: .Range("N6:P15").Copy
    End Select
    End With

    Dim PPT As PowerPoint.Application
    Dim myShapeRange As PowerPoint.Shape
    Dim myPresentation As PowerPoint.Presentation
    Dim ppSlide As PowerPoint.Slide
    Dim SlideNum As Integer
    Set PPT = New PowerPoint.Application
    PPT.Visible = True
    PPT.Presentations.Open Filename:="C:\Users\vk307d\Desktop\Staff Meeting Template.pptm"
    PPT.Activate
    PPT.ActivePresentation.Slides(2).Shapes.Paste
    ' PPT.ActivePresentation.Slides(2).Shapes(1).Table.Cell(3, 10).Paste

    End Sub

+ 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. Replies: 7
    Last Post: 08-10-2014, 08:30 AM
  2. Linking to specific powerpoint slide
    By Jdaly in forum Excel General
    Replies: 1
    Last Post: 01-17-2014, 12:28 PM
  3. add a specific slide to a powerpoint array of slides
    By aviben@bezeqint in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-31-2013, 07:27 AM
  4. [SOLVED] Copying worksheetname to powerpoint slide
    By irfanparbatani in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-30-2012, 01:04 AM
  5. [SOLVED] Link from an Excel spreadsheet to a specific slide in PowerPoint
    By VAB Charlie in forum Excel General
    Replies: 1
    Last Post: 02-22-2005, 07:06 PM

Tags for this Thread

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