Solved

VBA (Excel graph to Power Point)

Posted on 2016-09-29
8
31 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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
 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
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.

776 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