+ Reply to Thread
Results 1 to 3 of 3

[SOLVED] How to export all chartobjects in a sheet to powerpoint (creating a new ppt

  1. #1
    Gunnar Johansson
    Guest

    [SOLVED] How to export all chartobjects in a sheet to powerpoint (creating a new ppt

    Hi,

    I've seen some code examples doing this, does anybody have it or know it?

    Question: I have no control what office version except that it is not -97
    but 2000 or later. Are there any things I need to know/think of regarding
    that?

    Kind Regards



  2. #2
    John Mansfield
    Guest

    RE: How to export all chartobjects in a sheet to powerpoint (creating

    Gunnar,

    Jon Peltier has some very detailed instructions on his site that might help:

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

    --

    Regards,
    John Mansfield
    http://www.pdbook.com


    "Gunnar Johansson" wrote:

    > Hi,
    >
    > I've seen some code examples doing this, does anybody have it or know it?
    >
    > Question: I have no control what office version except that it is not -97
    > but 2000 or later. Are there any things I need to know/think of regarding
    > that?
    >
    > Kind Regards
    >
    >
    >


  3. #3
    Registered User
    Join Date
    08-27-2003
    Location
    Perth, Australia
    MS-Off Ver
    2000
    Posts
    47
    Hi

    I use this code to copy charts on chartsheets as pictures into powerpoint, then save the file in a temporary directory. Pictures are quickest, and I find they use the least memory in the powerpoint presentation (this exports 270 charts in less than 2 minutes, and the final powerpoint file is just over 1MB)

    you will need to adjust the chart's dimensions on pasting depending on their original size.

    Sub powerpoint_export_charts()
    'copies pictures of all charts in the workbook into a new pp presentation
    'ensure microsoft powerpoint object library is checked in tools references

    Dim PwrPtApp As PowerPoint.Application
    Dim PwrPtPres As PowerPoint.Presentation
    Dim PwrPtSlide As PowerPoint.Slide

    Set PwrPtApp = CreateObject("Powerpoint.Application")
    PwrPtApp.Visible = True
    Set PwrPtPres = PwrPtApp.Presentations.add

    For n = 1 To ActiveWorkbook.Charts.Count
    ActiveWorkbook.Charts(n).CopyPicture
    PwrPtPres.Slides.add n, ppLayoutBlank
    PwrPtPres.Slides(n).Shapes.Paste
    PwrPtPres.Slides(n).Shapes(1).Width = 700
    PwrPtPres.Slides(n).Shapes(1).Left = 8
    PwrPtPres.Slides(n).Shapes(1).Top = 12
    Next

    PwrPtApp.WindowState = ppWindowMinimized

    res = "c:\temp\charts " & Format(Date, "dd mmm yy" & ".ppt")
    res = InputBox("enter file save path and name", "file save", res)
    If res <> "" Then
    With PwrPtPres
    .SaveAs res
    .Close
    End With

    PwrPtApp.Quit

    Set PwrPtSlide = Nothing
    Set PwrPtPres = Nothing
    Set PwrPtApp = Nothing

    End If
    End Sub
    Nicky

+ Reply to Thread

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.6.0 RC 1