473,386 Members | 1,886 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Extracting data from Powerpoint datasheet/MSgraph to Excel

Hi,

I'm trying to use VBA to extract underlying data from charts in powerpoint to excel, i.e from the underlying powerpoint datasheet that feeds the chart.

I've found the macro below on the net. It copies the data in each chart/datasheet and slide in powerpoint but I'm struggling with the bit to get the data into excel.

Below it I've tried incoporating some code to paste into excel but it does not seem to work.

Hope someone can help.

Thanks,

Lucas
Expand|Select|Wrap|Line Numbers
  1. Sub GetChartData1() 'copies data from sheet
  2. Dim s As Shape 'gr As Graph.Chart
  3. Dim gr As Object
  4. Dim sl As Slide
  5. 'Copies data from datasheet in powerpoint
  6. For Each sl In ActivePresentation.Slides
  7. For Each s In sl.Shapes
  8. If s.Type = msoEmbeddedOLEObject Then
  9. 'we have found an OLE object
  10. 'check if it's a graph
  11. If s.OLEFormat.ProgID = "MSGraph.Chart.8" Then
  12. 'this might vary depending on what version you're using
  13. 'now get a handle on the graph object itself
  14. Set gr = s.OLEFormat.Object
  15. gr.Application.DataSheet.Cells.Copy
  16.  
  17. End If
  18. End If
  19. Next s
  20. Next sl
  21.  
  22. End Sub
  23.  
  24. Sub GetChartData2() ' includes code to paste into excel
  25. Dim s As Shape 'gr As Graph.Chart
  26. Dim gr As Object
  27. Dim sl As Slide
  28. 'Copies data from datasheet in powerpoint
  29. For Each sl In ActivePresentation.Slides
  30. For Each s In sl.Shapes
  31. If s.Type = msoEmbeddedOLEObject Then
  32. 'we have found an OLE object
  33. 'check if it's a graph
  34. If s.OLEFormat.ProgID = "MSGraph.Chart.8" Then
  35. 'this might vary depending on what version you're using
  36. 'now get a handle on the graph object itself
  37. Set gr = s.OLEFormat.Object
  38. gr.Application.DataSheet.Cells.Copy
  39.  
  40. 'Paste into excel - this section not working
  41.  
  42. Workbooks("test.xls").Sheets("sheet1").Activate
  43. Range("B1").Select
  44. Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
  45. :=False, Transpose:=False
  46.  
  47. End If
  48. End If
  49. Next s
  50. Next sl
  51.  
  52. End Sub
  53.  
Dec 4 '08 #1
2 6396
Dököll
2,364 Expert 2GB
Greetings, LucasLondon!

Looks like you putin a lot of work into this, great job...

I will send over to our friends in VBA to see what can be salvaged.

Please come back to us if VB 6 is what you needed.

Good luck with the project!

Dököll
Dec 6 '08 #2
Hello Dokoll,

Just to let you know, I'm trying to do this in VBA from within excel or powerpoint and not in a standalone VB application, although of course I understand that VBA and VB are the same language!

Thanks for your effort. Looking forward to seeing some kind of soultion.

Lucas
Dec 17 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: phong.lee | last post by:
Here is an issue i've been trying to figure out which i do not have an answer to. Basically i have an excel spreadsheet which has data that i copy and paste from another resource. I also created...
1
by: 333sridhar333 | last post by:
Hi, I am having a problem in exporting a data from jsp to excel. I am getting the values from a servlet and populating it to a JSP. And form there i export them to Excel. The functionality...
2
by: 333sridhar333 | last post by:
Hi, I am having a problem in exporting a data from jsp to excel. I am getting the values from a servlet and populating it to a JSP. And form there i export them to Excel. The functionality...
0
by: Sunil Basu | last post by:
Hi, I have a interesting thing to know and discuss with you. I am extracting data from an Excel file in a Delphi DbGrid through SQL. I want to create a criteria on a specific cell value of the...
0
by: runner7 | last post by:
I used file_get_contents() to read a pdf into a string and then tried to extract the encoded part between the "stream" and "endstream" words using the strpos() and substr() functions. (I could not...
0
by: sgsiaokia | last post by:
I need help in extracting data from another source file using VBA. I have problems copying the extracted data and format into the required data format. And also, how do i delete the row that is not...
1
by: JSagar | last post by:
Hello Expert ! I am new to python , i had done 'C' Code , which extracted file data , But i don't want to give my exe On remote side. Following thing is it Possible using python? -...
3
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I have a question for you. I have a .csv file which has many lines of data. Each line has many data fields which are delimited by ",". Now I need to extract part of data from this...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.