Solved

VBA (Excel graph to Power Point)

Posted on 2016-09-29
8
19 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 31

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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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 31

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 13

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
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…

706 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

16 Experts available now in Live!

Get 1:1 Help Now