Solved

VBA (Excel graph to Power Point)

Posted on 2016-09-29
8
26 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 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
 
LVL 32

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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 32

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

914 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now