LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
KJD KJD is offline
external usenet poster
 
Posts: 2
Default Powerpoint charting from excel

Hi,

I have put my code below that I am attempting to open
PowerPoint and insert a new slide containing a chart -
however when I try to access the chart (lines highlighted
with a *** below) the program crashes - is there anyone
who can help me with the correct code please?

Many thanks in advance

KJD


Dim oPPTShape As PowerPoint.Shape
Dim rngNewRange As Excel.Range
Dim oGraph As Object
Dim lLastSlide As Long

' Change this to the auto layout you want to use. This
value can be
' any PpSlideLayout constant.
Const DEFAULT_AUTO_LAYOUT As Long = ppLayoutChart
' Get the number of slides in the active presentation.
lLastSlide = oPPTApp.ActivePresentation.Slides.Count
lLastSlide = lLastSlide + 1
oPPTApp.ActivePresentation.Slides.Add lLastSlide,
DEFAULT_AUTO_LAYOUT

With oPPTApp.ActivePresentation.Slides(lLastSlide)
With .Shapes(1)
With .TextFrame.TextRange
.Text = chart_title
.Font.Name = "Arial"
.Font.Size = 24
End With
End With
Set oPPTShape = oPPTApp.ActivePresentation.Slides
(lLastSlide).Shapes(2)
**** oPPTShape.OLEFormat.Activate
**** Set rngNewRange = Sheets("charts").Range
(chart_range)
**** Sheets("charts").Select
**** Range(chart_range).Select
**** rngNewRange.Copy
**** Set oGraph = .OLEFormat.Object
**** oGraph.Application.DataSheet.Range
("A0:Z100").Delete
**** oGraph.Application.DataSheet.Range
("A0").Paste False
**** oGraph.Application.Update
Set oPPTShape = Nothing
End With


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel-Powerpoint Denver Charts and Charting in Excel 1 June 21st 09 10:57 AM
charting from excel to PowerPoint HuaXC Charts and Charting in Excel 1 September 15th 06 08:27 PM
excel to powerpoint confused Excel Worksheet Functions 1 October 5th 05 05:40 PM
EXCEL AND POWERPOINT CANDELYN. CARPENTER New Users to Excel 2 May 12th 05 01:10 PM
Custom charting - Stacked charting with a line Randy Lefferts Charts and Charting in Excel 3 March 3rd 05 03:10 AM


All times are GMT +1. The time now is 07:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"