PC Review


Reply
Thread Tools Rate Thread

Chart to PPT without opening PowerPoint

 
 
Abdul
Guest
Posts: n/a
 
      6th Nov 2006
By modifying the code available in this group now i can have each chart
sheet in seperate slides.

Is there a way that I can have this without activating powerpoint? when
i do this without activating I get only once slide..

Thanks


Sub Chart2PPT()

Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide
Dim PPShape As PowerPoint.Shape
Dim Fname As Variant
Dim CurTitle As Variant
Dim SlideCount As Long
Dim iCht As Chart

Set PPApp = CreateObject("Powerpoint.Application")
Set PPPres = PPApp.Presentations.Add

Application.ScreenUpdating = False
CurTitle = "XlChartToPPT"

Fname = ThisWorkbook.Path & Application.PathSeparator & CurTitle &
".ppt"

For Each iCht In ActiveWorkbook.Charts

iCht.CopyPicture xlScreen, xlPicture, xlScreen
SlideCount = PPPres.Slides.Count

Set PPSlide = PPPres.Slides.Add(SlideCount + 1, ppLayoutBlank)
PPApp.Visible = True
AppActivate PPApp.Name

With PPSlide

.Shapes.Paste
Set PPShape = .Shapes(.Shapes.Count)
PPShape.Left = 0#
PPShape.Top = 0#
End With
SlideCount = SlideCount + 1
Next iCht
With PPPres
.SaveAs Fname
.Close
End With

PPApp.Quit

Set PPApp = Nothing
Set PPPres = Nothing

End Sub

 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWFyayBJdmV5?=
Guest
Posts: n/a
 
      8th Nov 2006
Abdul,

I have been looking over your code. It does not transfer any information
over to the presentation. Is it still a work in progress?

I have been trying to find one I built a long time back...

I will post it as soon as I can find it.

--
Mark Ivey


"Abdul" wrote:

> By modifying the code available in this group now i can have each chart
> sheet in seperate slides.
>
> Is there a way that I can have this without activating powerpoint? when
> i do this without activating I get only once slide..
>
> Thanks
>
>
> Sub Chart2PPT()
>
> Dim PPApp As PowerPoint.Application
> Dim PPPres As PowerPoint.Presentation
> Dim PPSlide As PowerPoint.Slide
> Dim PPShape As PowerPoint.Shape
> Dim Fname As Variant
> Dim CurTitle As Variant
> Dim SlideCount As Long
> Dim iCht As Chart
>
> Set PPApp = CreateObject("Powerpoint.Application")
> Set PPPres = PPApp.Presentations.Add
>
> Application.ScreenUpdating = False
> CurTitle = "XlChartToPPT"
>
> Fname = ThisWorkbook.Path & Application.PathSeparator & CurTitle &
> ".ppt"
>
> For Each iCht In ActiveWorkbook.Charts
>
> iCht.CopyPicture xlScreen, xlPicture, xlScreen
> SlideCount = PPPres.Slides.Count
>
> Set PPSlide = PPPres.Slides.Add(SlideCount + 1, ppLayoutBlank)
> PPApp.Visible = True
> AppActivate PPApp.Name
>
> With PPSlide
>
> .Shapes.Paste
> Set PPShape = .Shapes(.Shapes.Count)
> PPShape.Left = 0#
> PPShape.Top = 0#
> End With
> SlideCount = SlideCount + 1
> Next iCht
> With PPPres
> .SaveAs Fname
> .Close
> End With
>
> PPApp.Quit
>
> Set PPApp = Nothing
> Set PPPres = Nothing
>
> End Sub
>
>

 
Reply With Quote
 
Mark Ivey
Guest
Posts: n/a
 
      9th Nov 2006
Abdul,

After thinking about it...

I think you still need to open the presentation for this to work, but you
can set the visible properties to false to prevent the user from seeing what
is going on.

--
Mark Ivey

UoP e-mail: (E-Mail Removed)
Personal e-mail: (E-Mail Removed)
"Abdul" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> By modifying the code available in this group now i can have each chart
> sheet in seperate slides.
>
> Is there a way that I can have this without activating powerpoint? when
> i do this without activating I get only once slide..
>
> Thanks
>
>
> Sub Chart2PPT()
>
> Dim PPApp As PowerPoint.Application
> Dim PPPres As PowerPoint.Presentation
> Dim PPSlide As PowerPoint.Slide
> Dim PPShape As PowerPoint.Shape
> Dim Fname As Variant
> Dim CurTitle As Variant
> Dim SlideCount As Long
> Dim iCht As Chart
>
> Set PPApp = CreateObject("Powerpoint.Application")
> Set PPPres = PPApp.Presentations.Add
>
> Application.ScreenUpdating = False
> CurTitle = "XlChartToPPT"
>
> Fname = ThisWorkbook.Path & Application.PathSeparator & CurTitle &
> ".ppt"
>
> For Each iCht In ActiveWorkbook.Charts
>
> iCht.CopyPicture xlScreen, xlPicture, xlScreen
> SlideCount = PPPres.Slides.Count
>
> Set PPSlide = PPPres.Slides.Add(SlideCount + 1, ppLayoutBlank)
> PPApp.Visible = True
> AppActivate PPApp.Name
>
> With PPSlide
>
> .Shapes.Paste
> Set PPShape = .Shapes(.Shapes.Count)
> PPShape.Left = 0#
> PPShape.Top = 0#
> End With
> SlideCount = SlideCount + 1
> Next iCht
> With PPPres
> .SaveAs Fname
> .Close
> End With
>
> PPApp.Quit
>
> Set PPApp = Nothing
> Set PPPres = Nothing
>
> End Sub
>



 
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
Extracting chart title from Embedded Excel Chart in PowerPoint Barb Reinhardt Microsoft Excel Programming 1 11th Jun 2008 02:22 PM
Extracting chart title from Embedded Excel Chart in PowerPoint Barb Reinhardt Microsoft Powerpoint 0 11th Jun 2008 01:31 PM
Export all chart sheets to PowerPoint with chart titles as slide title vsg@synergi.com Microsoft Powerpoint 1 23rd Jan 2006 07:58 PM
Opening a new PowerPoint chart with excel vba KDUT Microsoft Excel Programming 1 15th May 2004 04:39 AM
vc++ automation: opening chart as chart window and setting scale Mike Biolsi Microsoft Excel Programming 0 7th Feb 2004 08:13 AM


Features
 

Advertising
 

Newsgroups
 


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