+ Reply to Thread
Results 1 to 2 of 2

Excel 2007 : Create PPT slide presentation with Excel data. Chart is displayed off the slide.

  1. #1
    Registered User
    Join Date
    02-28-2012
    Location
    Herndon, VA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Create PPT slide presentation with Excel data. Chart is displayed off the slide.

    I am trying to create slides from Excel in my Powerpoint presentation.

    The code worked fine in Windows 2003.

    Any help in understanding why this is not working in 2007 is appreciated.

    The slides are copied into Powerpoint but they are not displayed on the slide properly. You can only see about half the slide and the rest is off the slide and not visible.

    Sub UpdateGraph()

    Dim SheetNum As Integer
    SheetNum = ActiveWorkbook.Worksheets.Count

    Dim PPapt As PowerPoint.Application
    Dim PPpres As PowerPoint.Presentation
    Dim rngNewRange As Excel.Range
    Dim Sh As Shape

    Set oPPTApp = CreateObject("PowerPoint.Application")
    oPPTApp.Visible = msoTrue
    Set PPpres = oPPTApp.Presentations.Open("C:\Presentation1.ppt")
    Dim SubclassArray(100, 2) As String
    For y% = 1 To 99
    SubclassArray(y%, 1) = Worksheets("List").Cells(y% + 2, 5).Value
    SubclassArray(y%, 2) = Worksheets("List").Cells(y% + 2, 6).Value
    Next

    For x% = 1 To 100
    Worksheets("OUT").Activate
    Worksheets("OUT").Range("D2").Value = SubclassArray(x%, 2)
    Set rngNewRange = Worksheets("OUT").Range("B2:L41")
    rngNewRange.Select
    rngNewRange.Copy

    PPpres.Slides(x%).Shapes.PasteSpecial ppPasteEnhancedMetafile

    PPpres.Slides(x%).Shapes(2).Height = 450
    PPpres.Slides(x%).Shapes(2).Width = 654
    PPpres.Slides(x%).Shapes(2).Left = 60
    PPpres.Slides(x%).Shapes(2).Top = 100

    Dim HeaderText As String
    HeaderText = "Class: " & SubclassArray(x%, 1)

    PPpres.Slides(x%).Shapes(1).TextFrame.TextRange.Text = HeaderText
    Next
    End Sub

  2. #2
    Registered User
    Join Date
    02-28-2012
    Location
    Herndon, VA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Create PPT slide presentation with Excel data. Chart is displayed off the slide.

    Any suggestions are greatly appreciated...

    Getting error
    Run-teim error
    Shapes.PasteSpecial : Invalid request. Clipboard is empty or contains data which may not be pasted here.

    Sub UpdateGraph()

    ' Set a VBE reference to Microsoft PowerPoint Object Library

    Dim SheetNum As Integer
    SheetNum = ActiveWorkbook.Worksheets.Count

    Dim rngNewRange As Excel.Range
    Dim Sh As Shape

    Set oPPTApp = CreateObject("PowerPoint.Application")
    oPPTApp.Visible = msoTrue
    Set PPPres = oPPTApp.Presentations.Open("C:\Presentation1.ppt")
    Dim SubclassArray(100, 2) As String
    For y% = 1 To 99
    SubclassArray(y%, 1) = Worksheets("List").Cells(y% + 2, 5).Value
    SubclassArray(y%, 2) = Worksheets("List").Cells(y% + 2, 6).Value
    Next

    For x% = 1 To 100
    Worksheets("OUT").Activate
    Worksheets("OUT").Range("D2").Value = SubclassArray(x%, 2)
    Set rngNewRange = Worksheets("OUT").Range("B2:L41")

    rngNewRange.Select
    rngNewRange.Copy

    With PPPres.Slides(x%).Shapes.PasteSpecial(ppPasteEnhancedMetafile)
    .Height = 410
    .Width = 630
    .Left = 40
    .Top = 75
    End With

    Dim HeaderText As String
    HeaderText = "Class: " & SubclassArray(x%, 1)

    With PPPres.Slides(x%).Shapes
    If .HasTitle Then _
    .Title.TextFrame.TextRange = HeaderText
    End With

    Next
    End Sub

+ 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