Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / February 2007

Tip: Looking for answers? Try searching our database.

copy Excel charts to PowerPoint and Word

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Cesar Camargos - 16 Feb 2007 18:33 GMT
Hi,
I have this situation:
1 excel sheet with sets of ten charts, with new one all month.

I need to make ppt and doc with this charts, how do I can automating this
copy?
I use office 2003

regards!
Charles Chickering - 16 Feb 2007 19:08 GMT
I don't program in Word so I can't help you there but this should fix your PP
issue:
Private Sub PushAllExcelPlotsToPowerPoint()
   
   
'**********************************************************************************
   ' This procedure pushes all Excel charts in the active workbook to
PowerPoint slides
   ' * If a PowerPoint presentation is not open, PowerPoint will be
launched (if
   '   necessary), a new Powerpoint presentation will be created, and the
slides
   '   will be added with all of the Excel charts.
   ' * If PowerPoint is already open, the Excel charts will be appended to
the
   '   active PowerPoint presentation.
   ' * Chart names will be used for slide titles.
   
'**********************************************************************************
   
   Dim PowerPointConn As Object
   Dim CurrentChart As Excel.Chart
   Dim SlideNumber As Integer, INI_File As String
   
   If ActiveChart Is Nothing Then End
   
   ' determine if custom or default INI file should be used
   INI_File = IniFileName
   
   On Error Resume Next
   Set PowerPointConn = GetObject(, "PowerPoint.Application")
   On Error GoTo 0
   If PowerPointConn Is Nothing Then Set PowerPointConn =
CreateObject("PowerPoint.Application")
   If PowerPointConn.Presentations.Count = 0 Then
PowerPointConn.Presentations.Add msoTrue
   PowerPointConn.Visible = msoTrue
   
   SlideNumber = PowerPointConn.ActivePresentation.Slides.Count + 1

   For Each CurrentChart In Charts
       CurrentChart.CopyPicture
       PowerPointConn.ActivePresentation.Slides.Add Index:=SlideNumber,
Layout:=11 ' ppLayoutTitleOnly = 11
       PowerPointConn.ActivePresentation.Slides(SlideNumber).Shapes.Paste
       
PowerPointConn.ActivePresentation.Slides(SlideNumber).Shapes(1).TextFrame.TextRange.Text = CurrentChart.Name
       
PowerPointConn.ActivePresentation.Slides(SlideNumber).Shapes(2).Height =
Val(GetPrivateProfileString32(INI_File, "GENERAL", "PPT Plot Height", "385"))
       PowerPointConn.ActivePresentation.Slides(SlideNumber).Shapes(2).Top
= Val(GetPrivateProfileString32(INI_File, "GENERAL", "PPT Plot Top", "115"))
       PowerPointConn.ActivePresentation.Slides(SlideNumber).Shapes(2).Left
= Val(GetPrivateProfileString32(INI_File, "GENERAL", "PPT Plot Left", "85"))
       SlideNumber = SlideNumber + 1
   Next CurrentChart
   
   Set PowerPointConn = Nothing
   
End Sub

Signature

Charles Chickering

"A good example is twice the value of good advice."

> Hi,
> I have this situation:
[quoted text clipped - 5 lines]
>
> regards!
Cesar Camargos - 16 Feb 2007 19:34 GMT
Thanks a lot!!

> I don't program in Word so I can't help you there but this should fix your PP
> issue:
[quoted text clipped - 66 lines]
> >
> > regards!
Jon Peltier - 17 Feb 2007 15:12 GMT
There is additional explanation and more examples here:

   http://peltiertech.com/Excel/XL_PPT.html

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______

> Thanks a lot!!
>
[quoted text clipped - 78 lines]
>> >
>> > regards!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.