Solved

VBA (Excel graph to Power Point)

Posted on 2016-09-29
8
43 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 19

Accepted Solution

by:
Thommy earned 500 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 500 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
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!

 
LVL 33

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 33

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

739 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