Quantcast
Channel: General Office Development forum
Viewing all articles
Browse latest Browse all 2257

How can I create a macro in the workbook associated with a chart created in Word 2010 or PowerPoint 2010?

$
0
0

In PowerPoint 2010 or Word 2010, when I choose Insert -> Chart, it creates a new chart with an Excel worksheet for the data.

If I add a macro to the Excel worksheet, this seems to be discarded when I close the worksheet and re-open it.

However, it *is* possible to have a chart with macros, because I also have some Word documents & PowerPoint presentations that I created in Office 2003, which had embedded Excel charts with macros.  When I converted those to Office 2010, they look just like "normal" Office 2010 charts, but the macros are preserved.

It looks to me like the embedded chart that gets created when you choose Insert -> Chart is in the "pptx" format rather than the "pptm" format, and so macros are not saved.

(If I query ActiveWorkbook.FileFormat, I get "51", which is "Open Xml Spreadsheet";  this is indeed "pptx", as opposed to "Open Xml Spreadsheet with Macros", which is "52").

How can I insert a chart with the "pptm" behavior?

Thanks,

Gary


Viewing all articles
Browse latest Browse all 2257

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>