Supercharge your PowerPoint productivity with
Supercharge your PPT Productivity with PPTools - Click here to learn more.

Proud member of

PPTools

Image Export converts PowerPoint slides to high-quality images.

PPT2HTML exports HTML even from PowerPoint 2010 and 2013, gives you full control of PowerPoint HTML output, helps meet Section 508 accessibility requirements

Merge Excel data into PowerPoint presentations to create certificates, awards presentations, personalized presentations and more

Resize your presentations quickly and without distortion

Language Selector switches the text in your presentation from one language to another

FixLinks prevents broken links when you distribute PowerPoint presentations

Shape Styles brings styles to PowerPoint. Apply complex formatting with a single click.

Automate Excel from PowerPoint. Automate PowerPoint from Excel. And so on.

Excel MVP Jon Peltier's site includes this very useful Using Excel with Other Office Applications section. Recommended reading!

And here's a simple example of how you can retrieve data from an Excel worksheet embedded in a PPT slide.
It assumes you've copy/pasted a selection from an Excel worksheet into your presentation or used Insert, Object to bring in an Excel worksheet.

Be sure to select the Excel object before running the code. There's no error handling to protect you here.
Also, be sure the Immediate window is open; that's where the results are displayed. Press Ctrl+G to open it.

Sub GetXLSWorksheetDataExample()
' This assumes you've set a reference to the MS Excel object library in the IDE

    Dim oWorkbook As Excel.Workbook
    Dim oWorksheet As Excel.Worksheet
    Dim oSh As Shape

    Dim LastCol As Long
    Dim LastRow As Long
    Dim x As Long
    Dim y As Long

    ' This example assumes you've selected the excel object
    ' you want to work with
    Set oSh = ActiveWindow.Selection.ShapeRange(1)

    Set oWorkbook = oSh.OLEFormat.Object
    ' Use the first sheet in the work book
    Set oWorksheet = oWorkbook.worksheets(1)

    ' Get the last row/col
    With oWorksheet
        .Activate

        ' Find the extents of the data in the sheet
        LastRow = .Range("a65535").End(xlUp).Row
        LastCol = .Range("iv1").End(xlToLeft).Column

        ' Display the data
        For x = 1 To LastRow
            For y = 1 To LastCol
                Debug.Print "Row" & CStr(x) & ":Col" & CStr(y) & " " & .Cells(x, y)
            Next
        Next

    End With

    oWorkbook.Close (False)
    Set oWorkbook = Nothing
    Set oWorksheet = Nothing

End Sub

Did this solve your problem? If so, please consider supporting the PPT FAQ with a small PayPal donation.
Page copy protected against web site content infringement by Copyscape Contents © 1995 - 2022 Stephen Rindsberg, Rindsberg Photography, Inc. and members of the MS PowerPoint MVP team. You may link to this page but any form of unauthorized reproduction of this page's contents is expressly forbidden.

Supercharge your PPT Productivity with PPTools

content authoring & site maintenance by
Friday, the automatic faq maker (logo)
Friday - The Automatic FAQ Maker

Automate Excel from PowerPoint. Automate PowerPoint from Excel. And so on.
http://www.pptfaq.com/FAQ00368_Automate_Excel_from_PowerPoint-_Automate_PowerPoint_from_Excel-_And_so_on-.htm
Last update 07 June, 2011
Created: