LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.charting
mustang25
 
Posts: n/a
Default Automatically resize excel charts when exporting them to PowerPoin

The message below is in response to a solution for my question of whether it
is possible to build a macro that will export multiple Excel charts to a
PowerPoint presentation with one chart to a slide. The "responder" gave me
an ingenious solution that works perfectly. My next question is if those
charts can be automatically resized. Keep reading for details.

Jon,

This is working brilliantly. I'd like to throw one more challenge at you if
you don't mind. Is there a way to output the charts to PowerPoint with the
following parameters:

Height 5.66 inches
Width 9.66 inches
Horizontal Position 0 inches from top left corner
Vertical Position 1 inch from top left corner

Here is the current code I'm using for the macro (you'll notice that I
removed the line/command that copies the chart as a picture. This is
intentional.):

Sub ChartsToPresentation()
' Set a VBE reference to Microsoft PowerPoint Object Library

Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide
Dim PresentationFileName As Variant
Dim SlideCount As Long
Dim iCht As Integer

' Reference existing instance of PowerPoint
Set PPApp = GetObject(, "Powerpoint.Application")
' Reference active presentation
Set PPPres = PPApp.ActivePresentation
PPApp.ActiveWindow.ViewType = ppViewSlide

For iCht = 1 To ActiveSheet.ChartObjects.Count
' copy chart as a picture
ActiveSheet.ChartObjects(iCht).Copy

' Add a new slide and paste in the chart
SlideCount = PPPres.Slides.Count
Set PPSlide = PPPres.Slides.Add(SlideCount + 1, ppLayoutBlank)
PPApp.ActiveWindow.View.GotoSlide PPSlide.SlideIndex
With PPSlide
' paste and select the chart picture
.Shapes.Paste.Select
' align the chart
PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True
PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, True
End With

Next

' Clean up
Set PPSlide = Nothing
Set PPPres = Nothing
Set PPApp = Nothing

End Sub


Many thanks in advance!
 
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
insert excel charts as objects mcarrington Charts and Charting in Excel 3 January 7th 06 04:57 AM
insert excel charts as objects mcarrington Excel Discussion (Misc queries) 0 January 5th 06 03:40 PM
Excel should heavily extend the options for black-white charts Dan from Sweden Charts and Charting in Excel 0 October 17th 05 01:26 PM
Excel Charts Larry Excel Charts and Charting in Excel 1 July 30th 05 06:38 PM
Urgent help! how to automatically resize all the charts? crossingmind Excel Worksheet Functions 2 April 28th 05 04:56 PM


All times are GMT +1. The time now is 11:29 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"