+ Reply to Thread
Results 1 to 2 of 2

How to Convert Excel Graphs into the PowerPoint Slides for specified ranges

  1. #1
    Registered User
    Join Date
    06-05-2012
    Location
    usa
    MS-Off Ver
    Excel 2007
    Posts
    37

    How to Convert Excel Graphs into the PowerPoint Slides for specified ranges

    Hey,

    Somewhat new to VBA. Trying export specified excel graphs into PowerPoint slide. Through research and analysis, I have the code below. Which imports a range of the excel sheet into the PowerPoint slides. My issue is that in the same sheet there are 10 other graphs and would need to import those as well not just one graph.I am having hard time figuring out how to specify those ranges in the code below so that each graph would be imported in to a new slide. Any help is much appreciated. Thanks in advance!!



    Sub sbPowePoint_SendDataFromExcelToPPT()

    'Declarations
    Dim oPPT As PowerPoint.Application
    Dim oPPres As PowerPoint.Presentation
    Dim oPSlide As PowerPoint.Slide
    Dim sText As String

    'Open PowerPoint
    Set oPPT = New PowerPoint.Application
    Set oPPres = oPPT.Presentations.Add
    oPPT.Visible = True

    'Add a Slide
    Set oPSlide = oPPres.Slides.Add(1, ppLayoutTitleOnly)
    oPSlide.Select

    'Copy a range as a picture and align it
    ActiveSheet.Range("A1:B10").CopyPicture Appearance:=xlScreen, Format:=xlPicture
    oPSlide.Shapes.Paste.Select
    oPPT.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True
    oPPT.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, True

    'Add the title text
    sText = "My Header"
    oPSlide.Shapes.Title.TextFrame.TextRange.Text = sText

    oPPT.Activate

    'Release Objects

    Set oPSlide = Nothing
    Set oPPres = Nothing
    Set oPPT = Nothing

    End Sub

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,406

    Re: How to Convert Excel Graphs into the PowerPoint Slides for specified ranges

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

+ 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. 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
  2. Using Excel VBA to input slides and put title in a Powerpoint
    By kavindra in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-12-2013, 09:01 AM
  3. 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
  4. 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
  5. Excel formulas on different Powerpoint Slides
    By liseladele in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-31-2006, 07:28 PM

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