Results 1 to 3 of 3

Auto Pasting Excel Range into Specific Slides in Powerpoint (macro/vba)

Threaded View

  1. #1
    Registered User
    Join Date
    10-30-2017
    Location
    Seattle, Washington
    MS-Off Ver
    2013
    Posts
    11

    Auto Pasting Excel Range into Specific Slides in Powerpoint (macro/vba)

    I have a code that pastes a selected range directly into an active powerpoint slide in the form of a picture. I would like to have the button, titled go, run through a series where it automatically selects each of the 4 tables ( in the excel workbook included) and pastes them on different slides by activating them through slide names.


    Private Sub CommandButton1_Click()
    
    ' Set a VBE reference to Microsoft PowerPoint Object Library
    Dim PPApp As PowerPoint.Application
    Dim PPPres As PowerPoint.Presentation
    Dim PPSlide As PowerPoint.Slide
    
    ' Make sure a range is selected
    If Not TypeName(Selection) = "Range" Then
        MsgBox "Please select a worksheet range and try again.", vbExclamation, _
            "No Range Selected"
    Else
        ' Reference existing instance of PowerPoint
        Set PPApp = GetObject(, "Powerpoint.Application")
        ' Reference active presentation
        Set PPPres = PPApp.ActivePresentation
        PPApp.ActiveWindow.ViewType = ppViewSlide
        ' Reference active slide
        Set PPSlide = PPPres.Slides(PPApp.ActiveWindow.Selection.SlideRange.SlideIndex)
        
        ' Copy the range as a picture
        Selection.CopyPicture Appearance:=xlScreen, _
            Format:=xlPicture
    
        ' Paste the range
        PPSlide.Shapes.Paste.Select
        
       ' Position pasted chart
        PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True
        PPApp.ActiveWindow.Selection.ShapeRange.Top = 75
    
        ' Clean up
        Set PPSlide = Nothing
        Set PPPres = Nothing
        Set PPApp = Nothing
    End If
    
    End Sub
    Attached Files Attached Files
    Last edited by K_N; 03-20-2018 at 11:19 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. copy specific excel charts to a specific powerpoint slides
    By coolin in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-26-2019, 08:52 PM
  2. To paste range from Excel to existing slides in PowerPoint
    By ell_ in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-11-2017, 05:16 AM
  3. macro to copy chart from excel to powerpoint slides
    By subodhgyl in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-09-2015, 05:40 PM
  4. VBA Copy Range from Excel to Powerpoint slides
    By stepet5618 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-17-2014, 04:32 AM
  5. 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
  6. Looping macro to paste Excel ranges to new Powerpoint slides
    By sammonite in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-06-2012, 05:18 AM
  7. Pasting Selected Ranges into a PowerPoint Slides
    By NaNaBoo in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 04-02-2009, 10:58 AM

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