+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    mustang25
    Guest

    Multiple Excel Charts to PowerPoint

    OK, I think I have a question that will stump even the best of you!

    I have several worksheets that contain multiple charts. I want to copy the
    charts from Excel to PowerPoint with one chart to a slide. I can do so one
    at a time by copying and pasting them. The drawback is that it takes lots of
    time to do this because I'm working with 250+ charts. My question is if
    there is a way to quickly export the charts to PowerPoint so that each slide
    contains a different chart.

  2. #2
    Jon Peltier
    Guest

    Re: Multiple Excel Charts to PowerPoint

    Partway through this article you'll find programmatic approaches to that
    very problem:

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

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

    "mustang25" <mustang25@discussions.microsoft.com> wrote in message
    news:92E839B9-9C67-4276-A5A1-42142FD22E5E@microsoft.com...
    > OK, I think I have a question that will stump even the best of you!
    >
    > I have several worksheets that contain multiple charts. I want to copy
    > the
    > charts from Excel to PowerPoint with one chart to a slide. I can do so
    > one
    > at a time by copying and pasting them. The drawback is that it takes lots
    > of
    > time to do this because I'm working with 250+ charts. My question is if
    > there is a way to quickly export the charts to PowerPoint so that each
    > slide
    > contains a different chart.




  3. #3
    mustang25
    Guest

    Re: Multiple Excel Charts to PowerPoint

    It amazes me to see the amount of knowledge stored on these forums. I'm
    seriously impressed that there is an answer to my question. Thank you Jon.

    Unfortunately, my VB skills are at about the same level as my 2 year old
    son's. In other words, I don't know the first thing about it. I figured out
    how to paste the code into the VBE, but when I try to run the macro, I get an
    error saying "User Type not Defined." I know this has to be a very basic
    issue, but like I said, I don't know the first thing about VB. Am I better
    off just copying and pasting my charts one at a time?

    "Jon Peltier" wrote:

    > Partway through this article you'll find programmatic approaches to that
    > very problem:
    >
    > http://peltiertech.com/Excel/XL_PPT.html
    >
    > - Jon
    > -------
    > Jon Peltier, Microsoft Excel MVP
    > Peltier Technical Services
    > Tutorials and Custom Solutions
    > http://PeltierTech.com/
    > _______
    >
    > "mustang25" <mustang25@discussions.microsoft.com> wrote in message
    > news:92E839B9-9C67-4276-A5A1-42142FD22E5E@microsoft.com...
    > > OK, I think I have a question that will stump even the best of you!
    > >
    > > I have several worksheets that contain multiple charts. I want to copy
    > > the
    > > charts from Excel to PowerPoint with one chart to a slide. I can do so
    > > one
    > > at a time by copying and pasting them. The drawback is that it takes lots
    > > of
    > > time to do this because I'm working with 250+ charts. My question is if
    > > there is a way to quickly export the charts to PowerPoint so that each
    > > slide
    > > contains a different chart.

    >
    >
    >


  4. #4
    Jon Peltier
    Guest

    Re: Multiple Excel Charts to PowerPoint

    I suspect you didn't set the reference to PowerPoint. It's described higher
    on the page than the specific code you must have copied. Just under the big
    title "Activating Other Applications with Excel VBA".

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

    "mustang25" <mustang25@discussions.microsoft.com> wrote in message
    news:2EC76CDA-4DFB-44A9-B852-FBC833BD87E1@microsoft.com...
    > It amazes me to see the amount of knowledge stored on these forums. I'm
    > seriously impressed that there is an answer to my question. Thank you
    > Jon.
    >
    > Unfortunately, my VB skills are at about the same level as my 2 year old
    > son's. In other words, I don't know the first thing about it. I figured
    > out
    > how to paste the code into the VBE, but when I try to run the macro, I get
    > an
    > error saying "User Type not Defined." I know this has to be a very basic
    > issue, but like I said, I don't know the first thing about VB. Am I
    > better
    > off just copying and pasting my charts one at a time?
    >
    > "Jon Peltier" wrote:
    >
    >> Partway through this article you'll find programmatic approaches to that
    >> very problem:
    >>
    >> http://peltiertech.com/Excel/XL_PPT.html
    >>
    >> - Jon
    >> -------
    >> Jon Peltier, Microsoft Excel MVP
    >> Peltier Technical Services
    >> Tutorials and Custom Solutions
    >> http://PeltierTech.com/
    >> _______
    >>
    >> "mustang25" <mustang25@discussions.microsoft.com> wrote in message
    >> news:92E839B9-9C67-4276-A5A1-42142FD22E5E@microsoft.com...
    >> > OK, I think I have a question that will stump even the best of you!
    >> >
    >> > I have several worksheets that contain multiple charts. I want to copy
    >> > the
    >> > charts from Excel to PowerPoint with one chart to a slide. I can do so
    >> > one
    >> > at a time by copying and pasting them. The drawback is that it takes
    >> > lots
    >> > of
    >> > time to do this because I'm working with 250+ charts. My question is
    >> > if
    >> > there is a way to quickly export the charts to PowerPoint so that each
    >> > slide
    >> > contains a different chart.

    >>
    >>
    >>




  5. #5
    mustang25
    Guest

    Re: Multiple Excel Charts to PowerPoint

    Wow! You, sir, are my hero! Thank you very much!

    "Jon Peltier" wrote:

    > I suspect you didn't set the reference to PowerPoint. It's described higher
    > on the page than the specific code you must have copied. Just under the big
    > title "Activating Other Applications with Excel VBA".
    >
    > - Jon
    > -------
    > Jon Peltier, Microsoft Excel MVP
    > Peltier Technical Services
    > Tutorials and Custom Solutions
    > http://PeltierTech.com/
    > _______
    >
    > "mustang25" <mustang25@discussions.microsoft.com> wrote in message
    > news:2EC76CDA-4DFB-44A9-B852-FBC833BD87E1@microsoft.com...
    > > It amazes me to see the amount of knowledge stored on these forums. I'm
    > > seriously impressed that there is an answer to my question. Thank you
    > > Jon.
    > >
    > > Unfortunately, my VB skills are at about the same level as my 2 year old
    > > son's. In other words, I don't know the first thing about it. I figured
    > > out
    > > how to paste the code into the VBE, but when I try to run the macro, I get
    > > an
    > > error saying "User Type not Defined." I know this has to be a very basic
    > > issue, but like I said, I don't know the first thing about VB. Am I
    > > better
    > > off just copying and pasting my charts one at a time?
    > >
    > > "Jon Peltier" wrote:
    > >
    > >> Partway through this article you'll find programmatic approaches to that
    > >> very problem:
    > >>
    > >> http://peltiertech.com/Excel/XL_PPT.html
    > >>
    > >> - Jon
    > >> -------
    > >> Jon Peltier, Microsoft Excel MVP
    > >> Peltier Technical Services
    > >> Tutorials and Custom Solutions
    > >> http://PeltierTech.com/
    > >> _______
    > >>
    > >> "mustang25" <mustang25@discussions.microsoft.com> wrote in message
    > >> news:92E839B9-9C67-4276-A5A1-42142FD22E5E@microsoft.com...
    > >> > OK, I think I have a question that will stump even the best of you!
    > >> >
    > >> > I have several worksheets that contain multiple charts. I want to copy
    > >> > the
    > >> > charts from Excel to PowerPoint with one chart to a slide. I can do so
    > >> > one
    > >> > at a time by copying and pasting them. The drawback is that it takes
    > >> > lots
    > >> > of
    > >> > time to do this because I'm working with 250+ charts. My question is
    > >> > if
    > >> > there is a way to quickly export the charts to PowerPoint so that each
    > >> > slide
    > >> > contains a different chart.
    > >>
    > >>
    > >>

    >
    >
    >


  6. #6
    mustang25
    Guest

    Re: Multiple Excel Charts to PowerPoint

    Jon,

    This is working brilliantly. I'd like to throw one more challenge at you if
    you don't mind. It follows below. Here is the 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

    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

    Many thanks in advance!


    "Jon Peltier" wrote:

    > I suspect you didn't set the reference to PowerPoint. It's described higher
    > on the page than the specific code you must have copied. Just under the big
    > title "Activating Other Applications with Excel VBA".
    >
    > - Jon
    > -------
    > Jon Peltier, Microsoft Excel MVP
    > Peltier Technical Services
    > Tutorials and Custom Solutions
    > http://PeltierTech.com/
    > _______
    >
    > "mustang25" <mustang25@discussions.microsoft.com> wrote in message
    > news:2EC76CDA-4DFB-44A9-B852-FBC833BD87E1@microsoft.com...
    > > It amazes me to see the amount of knowledge stored on these forums. I'm
    > > seriously impressed that there is an answer to my question. Thank you
    > > Jon.
    > >
    > > Unfortunately, my VB skills are at about the same level as my 2 year old
    > > son's. In other words, I don't know the first thing about it. I figured
    > > out
    > > how to paste the code into the VBE, but when I try to run the macro, I get
    > > an
    > > error saying "User Type not Defined." I know this has to be a very basic
    > > issue, but like I said, I don't know the first thing about VB. Am I
    > > better
    > > off just copying and pasting my charts one at a time?
    > >
    > > "Jon Peltier" wrote:
    > >
    > >> Partway through this article you'll find programmatic approaches to that
    > >> very problem:
    > >>
    > >> http://peltiertech.com/Excel/XL_PPT.html
    > >>
    > >> - Jon
    > >> -------
    > >> Jon Peltier, Microsoft Excel MVP
    > >> Peltier Technical Services
    > >> Tutorials and Custom Solutions
    > >> http://PeltierTech.com/
    > >> _______
    > >>
    > >> "mustang25" <mustang25@discussions.microsoft.com> wrote in message
    > >> news:92E839B9-9C67-4276-A5A1-42142FD22E5E@microsoft.com...
    > >> > OK, I think I have a question that will stump even the best of you!
    > >> >
    > >> > I have several worksheets that contain multiple charts. I want to copy
    > >> > the
    > >> > charts from Excel to PowerPoint with one chart to a slide. I can do so
    > >> > one
    > >> > at a time by copying and pasting them. The drawback is that it takes
    > >> > lots
    > >> > of
    > >> > time to do this because I'm working with 250+ charts. My question is
    > >> > if
    > >> > there is a way to quickly export the charts to PowerPoint so that each
    > >> > slide
    > >> > contains a different chart.
    > >>
    > >>
    > >>

    >
    >
    >


  7. #7
    Jon Peltier
    Guest

    Re: Multiple Excel Charts to PowerPoint

    In a different forum I answered one way, that you should make it in Excel so
    that it comes out right in PowerPoint. I stick by that, but I'll answer the
    other way as well. You can adjust this part of the code to handle resizing
    of the chart.

    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

    Instead of centering the chart, position and resize it:

    With PPSlide
    ' paste and select the chart picture
    .Shapes.Paste.Select
    ' position the chart
    With PPApp.ActiveWindow.Selection.ShapeRange
    .Top = 72 ' points
    .Left = 0
    .Width = 9.66 * 72
    .Height = 5.66 * 72
    End With
    End With

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


    "mustang25" <mustang25@discussions.microsoft.com> wrote in message
    news:59D04694-67FF-4249-BC9A-D8D8E2998603@microsoft.com...
    > Jon,
    >
    > This is working brilliantly. I'd like to throw one more challenge at you
    > if
    > you don't mind. It follows below. Here is the 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
    >
    > 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
    >
    > Many thanks in advance!
    >
    >
    > "Jon Peltier" wrote:
    >
    >> I suspect you didn't set the reference to PowerPoint. It's described
    >> higher
    >> on the page than the specific code you must have copied. Just under the
    >> big
    >> title "Activating Other Applications with Excel VBA".
    >>
    >> - Jon
    >> -------
    >> Jon Peltier, Microsoft Excel MVP
    >> Peltier Technical Services
    >> Tutorials and Custom Solutions
    >> http://PeltierTech.com/
    >> _______
    >>
    >> "mustang25" <mustang25@discussions.microsoft.com> wrote in message
    >> news:2EC76CDA-4DFB-44A9-B852-FBC833BD87E1@microsoft.com...
    >> > It amazes me to see the amount of knowledge stored on these forums.
    >> > I'm
    >> > seriously impressed that there is an answer to my question. Thank you
    >> > Jon.
    >> >
    >> > Unfortunately, my VB skills are at about the same level as my 2 year
    >> > old
    >> > son's. In other words, I don't know the first thing about it. I
    >> > figured
    >> > out
    >> > how to paste the code into the VBE, but when I try to run the macro, I
    >> > get
    >> > an
    >> > error saying "User Type not Defined." I know this has to be a very
    >> > basic
    >> > issue, but like I said, I don't know the first thing about VB. Am I
    >> > better
    >> > off just copying and pasting my charts one at a time?
    >> >
    >> > "Jon Peltier" wrote:
    >> >
    >> >> Partway through this article you'll find programmatic approaches to
    >> >> that
    >> >> very problem:
    >> >>
    >> >> http://peltiertech.com/Excel/XL_PPT.html
    >> >>
    >> >> - Jon
    >> >> -------
    >> >> Jon Peltier, Microsoft Excel MVP
    >> >> Peltier Technical Services
    >> >> Tutorials and Custom Solutions
    >> >> http://PeltierTech.com/
    >> >> _______
    >> >>
    >> >> "mustang25" <mustang25@discussions.microsoft.com> wrote in message
    >> >> news:92E839B9-9C67-4276-A5A1-42142FD22E5E@microsoft.com...
    >> >> > OK, I think I have a question that will stump even the best of you!
    >> >> >
    >> >> >
    >> >> > I have several worksheets that contain multiple charts. I want to
    >> >> > copy
    >> >> > the
    >> >> > charts from Excel to PowerPoint with one chart to a slide. I can do
    >> >> > so
    >> >> > one
    >> >> > at a time by copying and pasting them. The drawback is that it
    >> >> > takes
    >> >> > lots
    >> >> > of
    >> >> > time to do this because I'm working with 250+ charts. My question
    >> >> > is
    >> >> > if
    >> >> > there is a way to quickly export the charts to PowerPoint so that
    >> >> > each
    >> >> > slide
    >> >> > contains a different chart.
    >> >>
    >> >>
    >> >>

    >>
    >>
    >>




  8. #8
    mustang25
    Guest

    Re: Multiple Excel Charts to PowerPoint

    Jon,

    I see what you meant in the other forum. You are right, the best way to
    approach this would be to have the charts sized properly in Excel to begin
    with. Be that as it may, your macro has already saved me HOURS of work in
    copying each chart to its own slide. I can deal with resizing them manually
    for now and will remember to size them properly in Excel the next time I do a
    project like this.

    Once again, many humble thanks.

    "Jon Peltier" wrote:

    > In a different forum I answered one way, that you should make it in Excel so
    > that it comes out right in PowerPoint. I stick by that, but I'll answer the
    > other way as well. You can adjust this part of the code to handle resizing
    > of the chart.
    >
    > 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
    >
    > Instead of centering the chart, position and resize it:
    >
    > With PPSlide
    > ' paste and select the chart picture
    > .Shapes.Paste.Select
    > ' position the chart
    > With PPApp.ActiveWindow.Selection.ShapeRange
    > .Top = 72 ' points
    > .Left = 0
    > .Width = 9.66 * 72
    > .Height = 5.66 * 72
    > End With
    > End With
    >
    > - Jon
    > -------
    > Jon Peltier, Microsoft Excel MVP
    > Tutorials and Custom Solutions
    > http://PeltierTech.com
    > _______
    >
    >
    > "mustang25" <mustang25@discussions.microsoft.com> wrote in message
    > news:59D04694-67FF-4249-BC9A-D8D8E2998603@microsoft.com...
    > > Jon,
    > >
    > > This is working brilliantly. I'd like to throw one more challenge at you
    > > if
    > > you don't mind. It follows below. Here is the 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
    > >
    > > 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
    > >
    > > Many thanks in advance!
    > >
    > >
    > > "Jon Peltier" wrote:
    > >
    > >> I suspect you didn't set the reference to PowerPoint. It's described
    > >> higher
    > >> on the page than the specific code you must have copied. Just under the
    > >> big
    > >> title "Activating Other Applications with Excel VBA".
    > >>
    > >> - Jon
    > >> -------
    > >> Jon Peltier, Microsoft Excel MVP
    > >> Peltier Technical Services
    > >> Tutorials and Custom Solutions
    > >> http://PeltierTech.com/
    > >> _______
    > >>
    > >> "mustang25" <mustang25@discussions.microsoft.com> wrote in message
    > >> news:2EC76CDA-4DFB-44A9-B852-FBC833BD87E1@microsoft.com...
    > >> > It amazes me to see the amount of knowledge stored on these forums.
    > >> > I'm
    > >> > seriously impressed that there is an answer to my question. Thank you
    > >> > Jon.
    > >> >
    > >> > Unfortunately, my VB skills are at about the same level as my 2 year
    > >> > old
    > >> > son's. In other words, I don't know the first thing about it. I
    > >> > figured
    > >> > out
    > >> > how to paste the code into the VBE, but when I try to run the macro, I
    > >> > get
    > >> > an
    > >> > error saying "User Type not Defined." I know this has to be a very
    > >> > basic
    > >> > issue, but like I said, I don't know the first thing about VB. Am I
    > >> > better
    > >> > off just copying and pasting my charts one at a time?
    > >> >
    > >> > "Jon Peltier" wrote:
    > >> >
    > >> >> Partway through this article you'll find programmatic approaches to
    > >> >> that
    > >> >> very problem:
    > >> >>
    > >> >> http://peltiertech.com/Excel/XL_PPT.html
    > >> >>
    > >> >> - Jon
    > >> >> -------
    > >> >> Jon Peltier, Microsoft Excel MVP
    > >> >> Peltier Technical Services
    > >> >> Tutorials and Custom Solutions
    > >> >> http://PeltierTech.com/
    > >> >> _______
    > >> >>
    > >> >> "mustang25" <mustang25@discussions.microsoft.com> wrote in message
    > >> >> news:92E839B9-9C67-4276-A5A1-42142FD22E5E@microsoft.com...
    > >> >> > OK, I think I have a question that will stump even the best of you!
    > >> >> >
    > >> >> >
    > >> >> > I have several worksheets that contain multiple charts. I want to
    > >> >> > copy
    > >> >> > the
    > >> >> > charts from Excel to PowerPoint with one chart to a slide. I can do
    > >> >> > so
    > >> >> > one
    > >> >> > at a time by copying and pasting them. The drawback is that it
    > >> >> > takes
    > >> >> > lots
    > >> >> > of
    > >> >> > time to do this because I'm working with 250+ charts. My question
    > >> >> > is
    > >> >> > if
    > >> >> > there is a way to quickly export the charts to PowerPoint so that
    > >> >> > each
    > >> >> > slide
    > >> >> > contains a different chart.
    > >> >>
    > >> >>
    > >> >>
    > >>
    > >>
    > >>

    >
    >
    >


  9. #9
    Jon Peltier
    Guest

    Re: Multiple Excel Charts to PowerPoint

    I first got into programming in order to save myself those hours of work.
    Tedious redundant work. Laziness is the other of innovation.

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


    "mustang25" <mustang25@discussions.microsoft.com> wrote in message
    news:40935D84-6851-4843-8B03-F698E4E7BB71@microsoft.com...
    > Jon,
    >
    > I see what you meant in the other forum. You are right, the best way to
    > approach this would be to have the charts sized properly in Excel to begin
    > with. Be that as it may, your macro has already saved me HOURS of work in
    > copying each chart to its own slide. I can deal with resizing them
    > manually
    > for now and will remember to size them properly in Excel the next time I
    > do a
    > project like this.
    >
    > Once again, many humble thanks.
    >
    > "Jon Peltier" wrote:
    >
    >> In a different forum I answered one way, that you should make it in Excel
    >> so
    >> that it comes out right in PowerPoint. I stick by that, but I'll answer
    >> the
    >> other way as well. You can adjust this part of the code to handle
    >> resizing
    >> of the chart.
    >>
    >> 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
    >>
    >> Instead of centering the chart, position and resize it:
    >>
    >> With PPSlide
    >> ' paste and select the chart picture
    >> .Shapes.Paste.Select
    >> ' position the chart
    >> With PPApp.ActiveWindow.Selection.ShapeRange
    >> .Top = 72 ' points
    >> .Left = 0
    >> .Width = 9.66 * 72
    >> .Height = 5.66 * 72
    >> End With
    >> End With
    >>
    >> - Jon
    >> -------
    >> Jon Peltier, Microsoft Excel MVP
    >> Tutorials and Custom Solutions
    >> http://PeltierTech.com
    >> _______
    >>
    >>
    >> "mustang25" <mustang25@discussions.microsoft.com> wrote in message
    >> news:59D04694-67FF-4249-BC9A-D8D8E2998603@microsoft.com...
    >> > Jon,
    >> >
    >> > This is working brilliantly. I'd like to throw one more challenge at
    >> > you
    >> > if
    >> > you don't mind. It follows below. Here is the 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
    >> >
    >> > 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
    >> >
    >> > Many thanks in advance!
    >> >
    >> >
    >> > "Jon Peltier" wrote:
    >> >
    >> >> I suspect you didn't set the reference to PowerPoint. It's described
    >> >> higher
    >> >> on the page than the specific code you must have copied. Just under
    >> >> the
    >> >> big
    >> >> title "Activating Other Applications with Excel VBA".
    >> >>
    >> >> - Jon
    >> >> -------
    >> >> Jon Peltier, Microsoft Excel MVP
    >> >> Peltier Technical Services
    >> >> Tutorials and Custom Solutions
    >> >> http://PeltierTech.com/
    >> >> _______
    >> >>
    >> >> "mustang25" <mustang25@discussions.microsoft.com> wrote in message
    >> >> news:2EC76CDA-4DFB-44A9-B852-FBC833BD87E1@microsoft.com...
    >> >> > It amazes me to see the amount of knowledge stored on these forums.
    >> >> > I'm
    >> >> > seriously impressed that there is an answer to my question. Thank
    >> >> > you
    >> >> > Jon.
    >> >> >
    >> >> > Unfortunately, my VB skills are at about the same level as my 2 year
    >> >> > old
    >> >> > son's. In other words, I don't know the first thing about it. I
    >> >> > figured
    >> >> > out
    >> >> > how to paste the code into the VBE, but when I try to run the macro,
    >> >> > I
    >> >> > get
    >> >> > an
    >> >> > error saying "User Type not Defined." I know this has to be a very
    >> >> > basic
    >> >> > issue, but like I said, I don't know the first thing about VB. Am I
    >> >> > better
    >> >> > off just copying and pasting my charts one at a time?
    >> >> >
    >> >> > "Jon Peltier" wrote:
    >> >> >
    >> >> >> Partway through this article you'll find programmatic approaches to
    >> >> >> that
    >> >> >> very problem:
    >> >> >>
    >> >> >> http://peltiertech.com/Excel/XL_PPT.html
    >> >> >>
    >> >> >> - Jon
    >> >> >> -------
    >> >> >> Jon Peltier, Microsoft Excel MVP
    >> >> >> Peltier Technical Services
    >> >> >> Tutorials and Custom Solutions
    >> >> >> http://PeltierTech.com/
    >> >> >> _______
    >> >> >>
    >> >> >> "mustang25" <mustang25@discussions.microsoft.com> wrote in message
    >> >> >> news:92E839B9-9C67-4276-A5A1-42142FD22E5E@microsoft.com...
    >> >> >> > OK, I think I have a question that will stump even the best of
    >> >> >> > you!
    >> >> >> >
    >> >> >> >
    >> >> >> > I have several worksheets that contain multiple charts. I want
    >> >> >> > to
    >> >> >> > copy
    >> >> >> > the
    >> >> >> > charts from Excel to PowerPoint with one chart to a slide. I can
    >> >> >> > do
    >> >> >> > so
    >> >> >> > one
    >> >> >> > at a time by copying and pasting them. The drawback is that it
    >> >> >> > takes
    >> >> >> > lots
    >> >> >> > of
    >> >> >> > time to do this because I'm working with 250+ charts. My
    >> >> >> > question
    >> >> >> > is
    >> >> >> > if
    >> >> >> > there is a way to quickly export the charts to PowerPoint so that
    >> >> >> > each
    >> >> >> > slide
    >> >> >> > contains a different chart.
    >> >> >>
    >> >> >>
    >> >> >>
    >> >>
    >> >>
    >> >>

    >>
    >>
    >>




Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0