+ Reply to Thread
Results 1 to 6 of 6

Looping macro to paste Excel ranges to new Powerpoint slides

Hybrid View

  1. #1
    Registered User
    Join Date
    03-22-2011
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    1

    Looping macro to paste Excel ranges to new Powerpoint slides

    I found a great starting point from http://peltiertech.com/Excel/XL_PPT.html which "Paste a Selected Excel Worksheet Range into the Active PowerPoint Slide" but it uses one selected range and pastes it to one PowerPoint page.

    I want to use multiple Excel ranges and paste each one to a new slide in PowerPoint. For example, I want to create a new PPT, paste Excel range "TableA" to PPT slide 1, then paste Excel range "TableB" to PPT slide 2, etc. Each range would be pasted in the center of the PPT slide.

    Here's the starter code from the website above:
    ******************************************************
    Sub RangeToPresentation()
    ' 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 piicture
        Selection.CopyPicture Appearance:=xlScreen, _
            Format:=xlPicture
    
        ' Paste the range
        PPSlide.Shapes.Paste.Select
        
        ' Align the pasted range
        PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True
        PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, True
    
        ' Clean up
        Set PPSlide = Nothing
        Set PPPres = Nothing
        Set PPApp = Nothing
    End If
    
    End Sub
    *****************************************************
    Never mind. I finally solved this one myself...
    Last edited by Cutter; 08-06-2012 at 10:40 AM. Reason: Added code tags

  2. #2
    Registered User
    Join Date
    06-14-2011
    Location
    Denver, Colorado
    MS-Off Ver
    Excel 2003
    Posts
    81

    Re: Looping macro to paste Excel ranges to new Powerpoint slides

    Hi Salmonite,

    Could you share your solution with me?

    I'm looking to do something similar, except for I'm not copying charts, but just individual cells, and hopefully each cell to a new powerpoint slide.

    Thanks a bunch,
    ML

  3. #3
    Registered User
    Join Date
    06-14-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Looping macro to paste Excel ranges to new Powerpoint slides

    Yes, I would be interested in that too!! I am trying to do something similar with one of my projects where I have multiple sets of data ranges in excel as well as charts which I want to get into a powerpoint so that I get a skeleton. This is a weekly exercise and I spend about 4 hours every week on it.

  4. #4
    Registered User
    Join Date
    07-15-2011
    Location
    Spain
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Looping macro to paste Excel ranges to new Powerpoint slides

    Yes, do share, please.

  5. #5
    Registered User
    Join Date
    08-06-2012
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Looping macro to paste Excel ranges to new Powerpoint slides

    Hi is it possible for you to send me this code as well?

    Thanks

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Looping macro to paste Excel ranges to new Powerpoint slides

    rick_tiger,

    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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