+ Reply to Thread
Results 1 to 3 of 3

Problem Automatically Importing Excel Graphs into Powerpoint.

  1. #1
    Registered User
    Join Date
    08-30-2006
    Posts
    1

    Problem Automatically Importing Excel Graphs into Powerpoint.

    Hi!

    Im having a real headache of a problem with Excel > Powerpoint I really cannot get my head around.

    I am creating a spreadsheet for someone. Basically on the spreadsheet is a 10 diffrent sets of data. Each set of data has a command button and when the command button is run this runs a macro. The macro selects 1 set of data, autofilters it to be all numbers higher than 0, then creates a graph in a new worksheet. The name of the worksheet is always the name of the graph.

    This works perfectly.

    The problem is, the user of the spreadsheet wants to be able to click another macro button which would Copy the Chart and automatically place it into a Powerpoint slide.

    Each set of data would need a button to copy it into a powerpoint slide.

    I have tried all kinds of macros to copy/paste into a Powerpoint object on a seperate worksheet but no matter what I do it does not seem to work!!!

    Any ideas on how could get this function to work?

    Thanks!

    Sawyer

  2. #2
    Forum Contributor
    Join Date
    09-04-2006
    Location
    Yorkshire, England
    Posts
    267

    Copy from excel and paste into powerpoint (Charts only)

    To paste an excel chart into a powerpoint slide you have to copy and past it over as a picture. (Can be hard to do i hope you know VBA)

    Sub PASTEINTOPOWERPOINT()
    ' Set a VBE reference to Microsoft PowerPoint Object Library

    '(To set a reference to an application's type library click references on the tools menu. Select the check boxes for the applications with type libraries you want to reference.)

    Dim PPApp As PowerPoint.Application
    Dim PPPres As PowerPoint.Presentation
    Dim PPSlide As PowerPoint.Slide

    ' Make sure a chart is selected
    If ActiveChart Is Nothing Then
    MsgBox "Please select a chart and try again.", vbExclamation, _
    "No Chart 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 chart as a picture
    ActiveChart.CopyPicture Appearance:=xlScreen, Size:=xlScreen, _
    Format:=xlPicture

    ' Paste chart
    PPSlide.Shapes.Paste.Select

    ' Align pasted chart
    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


    Hope it works for you
    JR
    Versions
    Mac OS X 'Leopard'
    Mac MS Office Excel 2004
    Windows XP
    MS Excel 2002
    MS Excel 2003

  3. #3
    Forum Contributor
    Join Date
    09-04-2006
    Location
    Yorkshire, England
    Posts
    267

    p.s

    Ps


    I got the above code from a friend, apparently he got it by searching from google

+ 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