473,785 Members | 2,824 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Extracting data from Powerpoint datasheet/MSgraph to Excel

16 New Member
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 6426
Dököll
2,364 Recognized Expert Top Contributor
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
LucasLondon
16 New Member
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
5143
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 an excel object in a module in access which directly links to the excel spreadsheet. The data in excel varies from day to day. i.e.(Spreadsheet will have data from 6/1/05 - 6/4/05 for one day, and it will increase by one day going forward.) ...
1
6976
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 works fine. But the problem is with the exported data. I am having values with leading zeros. for example: Patron Code
2
3581
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 works fine. But the problem is with the exported data. I am having values with leading zeros. for example: Patron Code
0
1568
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 excel file. I want to retrieve a record if the value of a particular column in excel say D4 is < 0 where D is the column and D4 the cell value. If this condition is met then we display that record in the Delphi DBGrid. Is this possible through a...
0
1377
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 get preg_match() to work.) The substr() pulled it out, but read past the length I entered by 12 characters to include "endstream en". Besides that minor problem, I tried gzuncompress() on the extracted string which only generated a data error....
0
1481
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 required in the output file, in the below example: The row, D0, is not needed. An Example Data Format From the SOURCE file: W1 W2 W3 W4 Oct05 AverageYield 95% 96% 92% 91% 94% D0 0.1 ...
1
1591
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? - using python i can run my exe OR write Whole code in python which run at client side But extracting data from Server side . - If not, is their any alternate way? Waiting for Reply ...
3
7163
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 file but save it as an excel file. The data in this excel file will be imported into an Access database. The
0
10324
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10090
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9949
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.