+ Reply to Thread
Results 1 to 6 of 6

Copying Data From Excel to a Powerpoint Presentation

Hybrid View

  1. #1
    Registered User
    Join Date
    07-11-2007
    Posts
    8

    Copying Data From Excel to a Powerpoint Presentation

    Hi All,

    Can anybody help me out by telling me hw can i transfer data from a range in an excel sheet to a powerpoint presentation??????

    Thanks to all in advance!!!!!!

  2. #2
    Registered User
    Join Date
    07-27-2007
    Posts
    8
    I've recently discovered this so you will need to test it.

    Create a graph in your excel file.

    Cut the graph and paste it into the powerpoint presentation.

    At this stage you can now delete the graph but the excel tabs in the background will remain active and allow formulas that can reference to your excel file.

    I have experienced two difficulties with this:

    - Its best to write your cell references in excel before doing cut / paste as its difficult to write them in powerpoint
    - If you ever change the data in excel, you need to open the presentation and refresh the excel extract manually by double clicking on it.

  3. #3
    Registered User
    Join Date
    07-11-2007
    Posts
    8
    thanks bro!!!!

    Is there a way of doin it through vb codes/macros????

  4. #4
    Forum Contributor
    Join Date
    09-04-2006
    Location
    Yorkshire, England
    Posts
    267
    Heres some sample vba code if your feeling brave!
    Not my code no idea were it came from (been years since ive used)

    Public Sub Create_PowerPoint_Presentation() 
    
    ' Because this module relies on late binding, it is 
    ' necessary to declare constants to be used with PowerPoint. 
        Const ppLayoutTitle As Integer = 1 
        Const ppLayoutText As Integer = 2 
        Const ppLayoutTitleOnly As Integer = 11 
        Const ppEffectFlyFromTop As Integer = 3330 
        Const ppEffectBoxIn As Integer = 3074 
        Const ppSlideShowUseSlideTimings As Integer = 2 
        Const ppEffectRandom As Integer = 513 
        Const ppWindowMaximized As Integer = 3 
        Const ppEffectCheckerboardDown As Integer = 1026 
        Const ppAdvanceOnTime As Integer = 2 
        Const ppAnimateByWord As Integer = 1 
        Const ppAnimateByFirstLevel As Integer = 1 
        Const ppEffectBoxOut As Integer = 3073 
         
    ' Variable Declarations: 
        Dim Pres1 As Object 
        Dim Slide1 As Object 
        Dim Shape1 As Object 
        Dim Shape2 As Object 
        Dim Shape3 As Object 
        Dim Shape4 As Object 
        Dim Shape5 As Object 
        Dim Picture1 As Object 
        Dim SlideNum As Integer 
        Dim x As Variant 
         
    ' The routine starts by using CreateObject to get 
    ' an object that points to PowerPoint. 
        Set PPTApp = CreateObject("PowerPoint.Application") 
         
    ' The PowerPoint window is then maximized and a 
    ' new presentation is added. 
        With PPTApp 
            .Visible = True 
            .WindowState = ppWindowMaximized 
            Set Pres1 = PPTApp.Presentations.Add 
        End With 
         
    ' The first slide is added -- the title slide. 
            Set Slide1 = Pres1.Slides.Add(1, ppLayoutTitleOnly) 
            Pres1.SlideMaster.Background.Fill.PresetTextured _ 
                msoTextureFishFossil 
             
    ' Then various properties of the first shape 
    ' on the title slide are set. 
        With Slide1 
            With .Shapes(1) 
                .Top = 120 
                With .TextFrame.TextRange 
                    .Text = "Setagaya Cycle" & Chr(13) & _ 
                        "Annual Sales Report" 
                    .Font.Size = 54 
                End With 
                With .AnimationSettings 
                    .EntryEffect = ppEffectCheckerboardDown 
                    .AdvanceMode = ppAdvanceOnTime 
                End With 
            End With 
             
    ' Three graphic objects representing a bicycle are added to 
    ' the slide. The objects are assigned one-color shades 
    ' and random build effects. 
            With Slide1.Shapes 
                Set Shape1 = .AddShape(msoShapeOval, _ 
                        100, 300, 200, 200) 
                With Shape1.Fill 
                    .ForeColor.RGB = RGB(255, 0, 0) 
                    .BackColor.RGB = RGB(255, 255, 255) 
                    .OneColorGradient msoGradientHorizontal, 1, 1 
                End With 
                With Shape1.AnimationSettings 
                    .EntryEffect = ppEffectRandom 
                    .AdvanceMode = ppAdvanceOnTime 
                End With 
                Set Shape2 = .AddShape(msoShapeOval, _ 
                        400, 300, 200, 200) 
                With Shape2.Fill 
                    .ForeColor.RGB = RGB(0, 255, 0) 
                    .BackColor.RGB = RGB(255, 255, 255) 
                    .OneColorGradient msoGradientHorizontal, 1, 1 
                End With 
                With Shape2.AnimationSettings 
                    .EntryEffect = ppEffectRandom 
                    .AdvanceMode = ppAdvanceOnTime 
                End With 
                Set Shape3 = .AddShape(msoShapeParallelogram, _ 
                    Shape1.Left + (Shape1.Width * 0.5), _ 
                    Shape1.Top + (Shape1.Height * 0.33), _ 
                    (Shape2.Left + (Shape2.Width * 0.5)) - _ 
                    (Shape1.Left + (Shape1.Width * 0.5)), _ 
                    Shape1.Height * 0.25) 
                With Shape3.Fill 
                    .ForeColor.RGB = RGB(0, 0, 255) 
                    .BackColor.RGB = RGB(255, 255, 255) 
                    .OneColorGradient msoGradientHorizontal, 1, 1 
                End With 
                With Shape3.AnimationSettings 
                    .EntryEffect = ppEffectRandom 
                    .AdvanceMode = ppAdvanceOnTime 
                End With 
            End With 
             
    ' Before moving to the second slide, the first slide 
    ' is assigned an advance time of 1 second and a random 
    ' entry effect. 
            With .SlideShowTransition 
                .AdvanceOnTime = True 
                .AdvanceTime = 1 
                .EntryEffect = ppEffectRandom 
            End With 
        End With 
    
    ' The second slide is added and activated. 
        SlideNum = Pres1.Slides.Count + 1 
        Set Slide1 = Pres1.Slides.Add(SlideNum, ppLayoutText) 
        PPTApp.ActiveWindow.View.GotoSlide SlideNum 
         
    ' As a text slide, the second slide contains two shapes 
    ' that can hold text. Text strings are assigned to both. 
    ' The second slide object holds bulleted points. A 
    ' continuous text string with line-feed characters--chr(13)-- 
    ' is assigned to the shape and used to create the bulleted points. 
        With Slide1 
            .Background.Fill.PresetTextured msoTextureBouquet 
            .Shapes(1).TextFrame.TextRange.Text = _ 
                "Revenue Growth by Region" 
            With .Shapes(2) 
                .TextFrame.TextRange.Text = "North" & Chr(13) & _ 
                        "Sales are getting Stronger every day." & _ 
                        Chr(13) & "South" & Chr(13) & _ 
                        "Revenue is at a record high." & _ 
                        Chr(13) & "East" & Chr(13) & _ 
                        "We can't grow any faster." & _ 
                        Chr(13) & "West" & Chr(13) & _ 
                        "This is by far the best year ever." 
    
    ' Through use of IndentLevel, even lines are indented. 
                For x = 1 To 8 
                    If x Mod 2 = 0 Then 
                        .TextFrame.TextRange.Lines(x, 1).IndentLevel = 2 
                    Else 
                        .TextFrame.TextRange.Lines(x, 1).IndentLevel = 1 
                    End If 
                 Next 
                .Left = 100 
                 
    ' A character fly-from-top build effect is then assigned 
    ' to the shape. 
                With .AnimationSettings 
                    .EntryEffect = ppEffectFlyFromTop 
                    .TextUnitEffect = ppAnimateByWord 
                    .TextLevelEffect = ppAnimateByFirstLevel 
                    .AdvanceMode = ppAdvanceOnTime 
                End With 
            End With 
             
    ' And lastly, advance time and entry effects are set 
    ' for the second slide. 
            With .SlideShowTransition 
                .AdvanceOnTime = True 
                .AdvanceTime = 1 
                .EntryEffect = ppEffectRandom 
            End With 
        End With 
         
    ' The third slide is added to the presentation and activated. 
        SlideNum = Pres1.Slides.Count + 1 
        Set Slide1 = Pres1.Slides.Add(SlideNum, ppLayoutTitleOnly) 
        PPTApp.ActiveWindow.View.GotoSlide SlideNum 
        With Slide1 
            .Shapes(1).TextFrame.TextRange.Text = _ 
                "Quarterly Sales Summary" 
            With .SlideShowTransition 
                .AdvanceOnTime = True 
                .AdvanceTime = 1 
                .EntryEffect = ppEffectRandom 
            End With 
        End With 
         
    ' After setting various effects for the slide, a worksheet 
    ' is copied from Sheet1 and pasted into the slide. The routine 
    ' then adjusts the size of the embedded Excel worksheet object 
    ' and assigns build effects. 
        Worksheets("Sheet1").Range("SalesTable").Copy 
        PPTApp.ActiveWindow.View.Paste 
        Set Shape4 = Slide1.Shapes(2) 
        With Shape4 
            .Top = .Top * 0.6 
            .Left = .Left * 0.4 
            .Width = .Width * 1.2 
            .Height = .Height * 1.2 
            With .AnimationSettings 
                .EntryEffect = ppEffectBoxOut 
                .AdvanceMode = ppAdvanceOnTime 
            End With 
        End With 
         
    ' Likewise, a chart is copied and pasted into the slide. 
        Worksheets("Sheet1").ChartObjects("SalesChart").Copy 
        PPTApp.ActiveWindow.View.Paste 
        Set Shape5 = Slide1.Shapes(3) 
        With Shape5 
            .Top = Shape4.Top + Shape4.Height + 20 
            .Left = Shape4.Left 
            .Width = Shape4.Width 
            .Height = .Height * 1.2 
            With .AnimationSettings 
                .EntryEffect = ppEffectBoxIn 
                .AdvanceMode = ppAdvanceOnTime 
            End With 
        End With 
         
    ' When all slides are built, the first slide is 
    ' activated, various parameters of the SlideShowSettings 
    ' object are set, and the Run method is called 
    ' on the SlideShowSettings object to start the show. 
        PPTApp.ActiveWindow.View.GotoSlide 1 
        With Pres1.SlideShowSettings 
            .StartingSlide = 1 
            .EndingSlide = 3 
            .AdvanceMode = ppSlideShowUseSlideTimings 
            .Run 
        End With 
    End Sub
    JR
    Versions
    Mac OS X 'Leopard'
    Mac MS Office Excel 2004
    Windows XP
    MS Excel 2002
    MS Excel 2003

  5. #5
    Forum Contributor
    Join Date
    09-04-2006
    Location
    Yorkshire, England
    Posts
    267
    Going to need some serious editing as well!
    But at least it will give you an idea of what to do.

  6. #6
    Registered User
    Join Date
    07-11-2007
    Posts
    8
    thanks a ton mate!!!!!

+ 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