Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VBA (Excel graph to Power Point)

Posted on 2016-09-29
8
Medium Priority
?
67 Views
Last Modified: 2016-11-09
Dears,
First of all i would like to thank you for reading my question!

I am really Need in your help!

i have  two Graphs in Excel Document (they are in different sheet-Sheet 1.Sheet 2)
Could you please let me know how can i create a button and by clicking this button to add this two grapghs in ONE Power Point Document, in one presentation (automatically)?Whats Code in VBA do i Need to write for solving this Problem?

Thank you so much a lot of times  in advance!!!
Excel-VBA.xlsx
0
Comment
Question by:Yana Burmistrova
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 19

Accepted Solution

by:
Thommy earned 2000 total points
ID: 41821235
You can use this VBA Code.
xls charts are transferred to ppt by copy & paste...

Sub MoveGraphXLS2PPT()

    Dim ppt_slide As PowerPoint.Slide
    Dim ppt_app As PowerPoint.Application
    Dim ppt_pres As PowerPoint.Presentation
    

    'Open PPT, add new presentation.
    Set ppt_app = New PowerPoint.Application
    Set ppt_pres = ppt_App.Presentations.Add(msoFalse)

    'Set the charts and copy them to a new ppt slide
    'I could have also used for every chart object line
    'but I have only 2 charts

    Set mychart = Worksheets("Sheet1").ChartObjects("Chart 1").Chart
    mychart.ChartArea.Copy
    Set ppt_slide = ppt_pres.Slides.Add(1, ppLayoutBlank)
    ppt_slide.Shapes.Paste

    Set mychart = Worksheets("Sheet2").ChartObjects("Chart 2").Chart
    mychart.ChartArea.Copy
    ppt_slide.Shapes.Paste

    'Save Images as png
    path = "C:\Temp\"

    For j = 1 To ppt_slide.Shapes.Count
        With ppt_slide.Shapes(j)
        .Export path & j & ".png", ppShapeFormatPNG
        End With
    Next j

    ppt_app.Quit

    Set ppt_slide = Nothing
    Set ppt_pres = Nothing
    Set ppt_app = Nothing

End Sub

Open in new window

0
 

Author Comment

by:Yana Burmistrova
ID: 41821244
Could you please elt me know,is it possible to do not with copy/past,but only automatic by clicking the button?
0
 
LVL 19

Assisted Solution

by:Thommy
Thommy earned 2000 total points
ID: 41821247
Simply run above Excel macro by button click.
Copy & Paste is down automatically by tje macro.

How to add a button to Excel...
Adding a Simple VBA Button to Excel
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 34

Expert Comment

by:Rob Henson
ID: 41821291
Recent versions of PowerPoint save the Graph data in an excel file.

if you recreate the graph in Powerpoint when you get to select the data you can just copy and paste the data from Excel or maybe link to the data in your existing worksheet.

Thanks
Rob H
0
 

Author Comment

by:Yana Burmistrova
ID: 41821671
Unfortunately,its no exactly what i Need....
0
 

Author Comment

by:Yana Burmistrova
ID: 41821672
I Need to press on the button,and automatically move all Graphs from one Excel document(Even from different Sheets)to one power Point presentation ...
0
 
LVL 34

Expert Comment

by:Rob Henson
ID: 41821725
Yeah, the one button will be on opening the file. There will be a warning asking whether to update links, click Yes.
0
 
LVL 14

Expert Comment

by:frankhelk
ID: 41880159
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Split:
-- Thommy (https:#a41821235)
-- Thommy (https:#a41821247)


If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

frankhelk
Experts-Exchange Cleanup Volunteer
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a serious pitfall that can happen when deleting shapes using VBA.
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Starting up a Project

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question