+ Reply to Thread
Results 1 to 13 of 13

Exporting Excel Data in Powerpoint presentation

Hybrid View

  1. #1
    Registered User
    Join Date
    06-14-2004
    Posts
    75

    Question Exporting Excel Data in Powerpoint presentation

    Hiya Experts!

    I would like to create a Powerpoint presentation template with some buttons on one page that allow the user to click and fetch the relevant data from an excel workbook based on the button.

    I tried to record a macro from Powerpoint to discover that it didn’t record any interaction between the two!

    I have surfed various forums and haven’t been able to locate code that could help…

    Would any of you have any idea on how to go about doing this? Where should the code sit? VBA Powerpoint? VBA Excel?

    Many thanks!

  2. #2
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    An example of a Powepoint macro which updates Excel links ...

    Sub ChangeExcelSource()
       Dim i As Integer
       Dim k As Integer
    
       ' Create a variable to store the worksheet reference string.
       Dim linkname As String
       ' Create a variable to store the position of the worksheet
       ' reference in the .SourceFullName property of the OLEFormat
       ' object.
       Dim linkpos As Integer
    
       ' Set a For loop to go from slide 1 to the last slide in the
       ' presentation.
       For i = 1 To ActivePresentation.Slides.Count
    
          ' Select the slide based on the index value.
          With ActivePresentation.Slides(i)
    
             ' Loop through all the objects on slide.
             For k = 1 To .Shapes.Count
    
                ' Use only shapes on the slide.
                With .Shapes(k)
    
                   ' If the shape's type is an OLE object then...
                   If .Type = msoLinkedOLEObject Then
    
                     ' Change the path to new source and set the update
                     ' type to Automatic. First find where the worksheet
                     ' reference is, and then store it in linkname. Next
                     ' assign the new path and concatenate the chart name
                     ' to the end of the path.
                     With .LinkFormat
    
                     ' Find where in the source path string the
                     ' character "!" occurs, and assign the position
                     ' to the variable linkpos.
                     linkpos = InStr(1, .SourceFullName, "!", _
                        vbTextCompare)
    
                     ' Assign linkname to worksheet reference at the
                     ' end of the source file path.
                     linkname = Right(.SourceFullName, _
                        Len(.SourceFullName) - linkpos)
                     .SourceFullName = "c:\document\fileb.xls!" & linkname
                        .AutoUpdate = ppUpdateOptionAutomatic
                     End With
                   End If
                End With
             Next k
          End With
       Next i
       ' Update all links in the presentation, so that the changes are
       ' visible and the source file locations are correct on the screen.
       ActivePresentation.UpdateLinks
       End Sub
    HTH
    Carim

  3. #3
    Registered User
    Join Date
    12-19-2006
    Posts
    15
    hi, even i have the same problem....
    i pasted the above code in the button macro....
    but the excel sheet give the message 'select destination and press ENTER or choose Paste', when i click on the button (which contains the above code).
    Microsoft Excel 2002 - SP3

  4. #4
    Registered User
    Join Date
    06-14-2004
    Posts
    75
    Hi
    Same here - just want to when clicking on the button go to Excel, copy the selected area and paste link within Powerpoint creating a new slide...

    Should be easy LOL

  5. #5
    Registered User
    Join Date
    12-19-2006
    Posts
    15
    hi, Let me state the problem clearly....
    I)
    I have
    1) an excel sheet with data from a1 to L60...
    Note: The format of each cells are different....
    2) a button

    II)
    What i want
    1) When i click on button the system should open a ppt containing the excel data on it....i.e. data from a1 to L60.....

    III)
    Problem I am facing....
    1) The system automatically opens the ppt, but the data gets pasted outside the workarea of PPT!


    Which code i have to use under the excel button in order to get a proper(formatted) powerpoint output?....
    Last edited by ssrirao; 12-19-2006 at 08:20 AM.

  6. #6
    Registered User
    Join Date
    06-14-2004
    Posts
    75
    Ssrirao - I have no idea!

    My original post was for that very reason.

    Except that i want to work from a powerpoint presentation and go fetch Excel data when clicking on a button on one slide.

    What i have is a Powerpoint presentation with circa 20 slides. On one slide there are buttons with customers.
    When the button for Customer A is clicked, the macro should:
    • Read the XL workbook
    • Find the relevant data (as pointed towards with code)
    • Copy the relevant pre-formatted XL data
    • Create a new slide in the powerpoint presentation
    • Past link the XL data

    I think this could be possible but i just have no idea how...

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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