How can I copy a graph in excel and paste it into word?

7 Ansichten (letzte 30 Tage)
Thomas Lee
Thomas Lee am 12 Jun. 2016
Beantwortet: Image Analyst am 13 Jun. 2016
I would like to copy a graph I made in an Excel file (there is only one graph in a file) and paste it onto a single Word file.
Instead of opening an excel file and pasting it onto a word file manually, I am trying to do this using MATLAB.
Can anyone help me do this? It seems like a relatively simple task but I'm not much of a MATLAB person.
Thank you.
  10 Kommentare
Thomas Lee
Thomas Lee am 12 Jun. 2016
Hello,
The chart can end up in word as an image, no issue there.
Marc:
As to why I want to do this, I have an many excel files with extensive calculations already done - which is why these files are so large. They have become very slow - almost 5 minutes to open, copy the chart into word as image, and close the file.
The graph is quite involved as it has jittering with layers of data with particular formatting and I would not want to reproduce the same graph in matlab when they are already produced in excel.
If it seems VBA would work better, I will look into it.
Marc
Marc am 13 Jun. 2016
Good luck... In my experience, excel only gets bulkier and in many cases kills computers. I work with data historians and people like to dump endless streams of second by second data into them... Useless.
Regardless, getting your data out of excel, running the calcs and plotting the results in Matlab is way better than coming up with some macro to keep the data stuck in excel. In my experience, a 70mb .mat file loads in Matlab effortlessly and you can quickly set up what if scenarios.
Bite the bullet, do yourself and the future of humanity a favor... Recreate the calcs in Matlab, allowing you to use an endless amount of functions/tools to improve you work processes.

Melden Sie sich an, um zu kommentieren.

Antworten (3)

Guillaume
Guillaume am 12 Jun. 2016
This is not really a matlab question as the code you'd write in matlab would be the same VBA code you'd write in Excel / Word to do the same thing. Plus, if it's just one graph it'd be faster to do it manually anyway.
In the end you've got to use Excel and Word object model. Probably the best way for you to find what the code should be would be to record a macro in excel where you copy the graph, and record a macro in word where you paste. The code in the macro would be the same you'd write in matlab.

Image Analyst
Image Analyst am 13 Jun. 2016
You can control both Excel and Word with ActiveX. I attach an example of how to communicate with Excel. You can do the same thing with Word. Basically the easy way to do it is to record a macro in Excel or Word and then edit the macro to see what it did. Then copy those lines of code to MATLAB. You may have to make a few slight modifications but at least you find out the methods you need to call.

Muhammad Usman Saleem
Muhammad Usman Saleem am 12 Jun. 2016
Bearbeitet: Guillaume am 12 Jun. 2016

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by