Supercharge your PowerPoint productivity with

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

Tell me about PPTools

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


PPTools
Shape Styles brings the power of styles to PowerPoint. Apply complex formatting with a single click
Merge Excel, CSV or tab-delimited data into PowerPoint presentations to create certificates, awards presentations, personalized presentations and more
FixLinks prevents broken links when you distribute PowerPoint presentations
Optimizer saves disk space and bandwidth, shrinks your PowerPoint presentations to the right size for email, screenshow or printing
PPT2HTML gives you full control of PowerPoint HTML output, helps meet Section 508 accessibility requirements
Prep4PDF preserves interactivity in PowerPoint presentations when you convert to PDF
Image Export converts PowerPoint slides to JPG, PNG, GIF, WMF and more

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

Page copy protected against web site content infringement by Copyscape Contents © 1995 - 2008 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.

Español    Deutsch    Français    Português    Italiano    Nederlands    Greek    Japanese    Korean    Chinese



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.htm
Last update 09 September, 2006