Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-28-2012, 02:04 PM
eratem eratem is offline Create PPT slide presentation with Excel data.  Chart is displayed off the slide. Windows XP Create PPT slide presentation with Excel data.  Chart is displayed off the slide. Office 2007
Novice
Create PPT slide presentation with Excel data.  Chart is displayed off the slide.
 
Join Date: Feb 2012
Posts: 3
eratem is on a distinguished road
Default 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.Te xt = HeaderText
Next
End Sub
Reply With Quote
  #2  
Old 02-28-2012, 03:15 PM
JohnWilson JohnWilson is offline Create PPT slide presentation with Excel data.  Chart is displayed off the slide. Windows 7 64bit Create PPT slide presentation with Excel data.  Chart is displayed off the slide. Office 2010 32bit
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,912
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

Are you sure the pasted shape IS Shapes(2)?
Maybe try
With PPpres.Slides(x%).Shapes.PasteSpecial(ppPasteEnhan cedMetafile)
.Height = 450
.Width = 654
.Left = 60
.Top = 100
End With
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote
  #3  
Old 02-29-2012, 09:19 AM
eratem eratem is offline Create PPT slide presentation with Excel data.  Chart is displayed off the slide. Windows XP Create PPT slide presentation with Excel data.  Chart is displayed off the slide. Office 2007
Novice
Create PPT slide presentation with Excel data.  Chart is displayed off the slide.
 
Join Date: Feb 2012
Posts: 3
eratem is on a distinguished road
Default Thank you John

Thank you John Wilson. Your method worked and positioned the chart on the page perfectly.
One more question if you know? The Title of the chart is positioned at the bottom of the page and the Title itself is left as "Click to add title". Do you know another method to position the title correctly at the top? Perhaps this is another change from Office 2003 to Office 2007? Any tips are appreciated.

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

With PPpres.Slides(x%).Shapes.PasteSpecial(ppPasteEnhan cedMetafile)
.Height = 410
.Width = 630
.Left = 40
.Top = 75
End With
' 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.Te xt = HeaderText
Next
End Sub
Reply With Quote
  #4  
Old 02-29-2012, 09:38 AM
JohnWilson JohnWilson is offline Create PPT slide presentation with Excel data.  Chart is displayed off the slide. Windows 7 64bit Create PPT slide presentation with Excel data.  Chart is displayed off the slide. Office 2010 32bit
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,912
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

Maybe
With pppres.Slides(x%).Shapes
If .HasTitle Then _
.Title.TextFrame.TextRange = HeaderText
End With
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote
  #5  
Old 02-29-2012, 09:44 AM
eratem eratem is offline Create PPT slide presentation with Excel data.  Chart is displayed off the slide. Windows XP Create PPT slide presentation with Excel data.  Chart is displayed off the slide. Office 2007
Novice
Create PPT slide presentation with Excel data.  Chart is displayed off the slide.
 
Join Date: Feb 2012
Posts: 3
eratem is on a distinguished road
Default

Once again, worked like a charm. Thanks so much for the help in this John. Truly appreciated!
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create PPT slide presentation with Excel data.  Chart is displayed off the slide. slide image wont copy with text to new slide lewis.mulhollen PowerPoint 1 12-17-2011 03:17 AM
PP 07 Random Chart Dissappearing in Slide Show DKY PowerPoint 0 11-02-2011 04:38 AM
Maintaining a shrunken object from slide to slide Straitsfan PowerPoint 0 05-18-2011 01:04 PM
What slide attribute can I use in VBA to detect hidden slide? mikel401 PowerPoint 1 02-22-2011 11:13 AM
Need to make a rotating slide presentation squatch97402 PowerPoint 0 12-03-2010 10:26 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:20 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft