I have a problem with inserting Excel Pivot Charts in Word documents and I was hoping that I someone can help.
The organisation I worked for deals with large datasets which contain health related information about our entire state (NSW). To make the information useful, staff used to create Pivot Tables/Pivot Chart for individual location, date range and disease and copy generated Pivot Charts to Word Reports. Each report contains between 320 and 680 charts. We decided to streamline the process by generating required charts using VBA and them link or copy them in Word report file. Creating pivot charts in Excel was easy; however, trying to link or copy Excel pivot charts to Word is proving to be more difficult then expected.
I just don’t seem to be able to see the chart (pivot or not) when I try to link or insert a chart into Word document.
For example, workbook called CamillaMonthlyRates1 - Total Seasonality Chart.xls has three sheets:
- CTSP1 Totals (contains raw data)
- CTSP1 Data (contains pivot table from the raw data)
- CTSP1 Chart (chart built using data from CTSP1 Data)
When I manually go to Word document and click Insert, File and locate CamillaMonthlyRates1 - Total Seasonality Chart.xls I am presented with a Open Worksheet form. Open a document in Workbook combo box defaults to Entire Workbook but when I open the combo box on only has three options:
The one I really want to I want to insert into Word document (CTSP1 Chart
) isn’t listed at all in the combo box so it can not be selected. I don’t know how to do it, do you? I would love to hear from you if you do.
NOTE: I tried exporting the chart as GIF using VBA so I can link to a graphic file but that doesn’t see to work as well as we expected either.
I used the following code during testing to generate the graphic:
'Export chart as graphic
strChartFileName = "N:\DATA\Projects\Area\CDAP\JF Charts\Charts\CTSP1" & Format(Date, "yymmdd") & ".gif"
ActiveChart.Export Filename:=strChartFileName, FilterName:="GIF"]
This resulting file was saved as "CTSP10~1.GIF" using DOS naming convention (8 characters long) with rest of the name truncated, not as "CTSP1060119.GIF" as expected with todays (19/1/2006) save. Saved chart also looks like a screen dump; combo boxes are displayed as grey combo boxes on screen, “Drop Series Fields Here” pivot table prompt is visible in the graphic just like on the screen and the quality is not great seem more blurred then when we used Windows Copy/Paste to copy chart from Excel to Word. I tried exporting using GIF and JPG format without much difference.