PC Review


Reply
Thread Tools Rate Thread

copy Excel charts to PowerPoint and Word

 
 
=?Utf-8?B?Q2VzYXIgQ2FtYXJnb3M=?=
Guest
Posts: n/a
 
      16th Feb 2007
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!
 
Reply With Quote
 
 
 
 
=?Utf-8?B?Q2hhcmxlcyBDaGlja2VyaW5n?=
Guest
Posts: n/a
 
      16th Feb 2007
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

--
Charles Chickering

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


"Cesar Camargos" wrote:

> 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!

 
Reply With Quote
 
=?Utf-8?B?Q2VzYXIgQ2FtYXJnb3M=?=
Guest
Posts: n/a
 
      16th Feb 2007
Thanks a lot!!


"Charles Chickering" wrote:

> 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
>
> --
> Charles Chickering
>
> "A good example is twice the value of good advice."
>
>
> "Cesar Camargos" wrote:
>
> > 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!

 
Reply With Quote
 
Jon Peltier
Guest
Posts: n/a
 
      17th Feb 2007
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
_______


"Cesar Camargos" <(E-Mail Removed)> wrote in message
news:3E053D16-AAB1-421E-A815-(E-Mail Removed)...
> Thanks a lot!!
>
>
> "Charles Chickering" wrote:
>
>> 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
>>
>> --
>> Charles Chickering
>>
>> "A good example is twice the value of good advice."
>>
>>
>> "Cesar Camargos" wrote:
>>
>> > 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!



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy Charts from Excel to Word kazoo Microsoft Excel Misc 1 27th Aug 2008 08:04 PM
Build custom charts in Excel and copy them to PowerPoint =?Utf-8?B?bXVzdGFuZzI1?= Microsoft Excel Programming 6 25th Nov 2006 07:21 PM
Copy Charts from Excel worksheet to PowerPoint =?Utf-8?B?S291bGxh?= Microsoft Excel Programming 3 30th Oct 2006 02:28 PM
Macro to copy Excel charts to existing Powerpoint file fg7@hotmail.com Microsoft Excel Programming 1 18th Sep 2006 08:32 PM
Can I export or copy the CHARTS to WORD or EXCEL ? Martin Microsoft Access 0 4th Dec 2005 09:08 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:21 AM.