Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Other Office > Word VBA
|
Word VBA Discuss using VBA to program Word.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Word VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 18th, 2006, 10:23 PM
Registered User
 
Join Date: Jan 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Inserting Excel pivot chart into Word documents

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:

 
  • Entire Workbook
  •  
  • CTSP1 Totals
     
  • CTSP1 Data


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:
Code:

Code:
'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.

Any suggestions?

 
Old January 23rd, 2006, 09:16 PM
Authorized User
 
Join Date: Dec 2005
Posts: 14
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to zach007
Default

Hi,

Please have a look to this link:

http://www.homeandlearn.co.uk/ME/mes12p1.html

and also this link:

http://msdn.microsoft.com/library/de...dc_bistwiz.asp

I wish that could help :)






Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting Excel pivot chart into Word document jfejsa Excel VBA 3 March 15th, 2007 03:53 PM
OWC10: binding Chart to Pivot Table rfrancisco Classic ASP Components 0 February 10th, 2006 01:47 PM
Inserting Word Documents into Access showie Access VBA 4 December 14th, 2005 02:02 PM
Pivot Chart View Problems wall_of_jericho Access 1 July 27th, 2005 11:05 AM
Using Customized chart for Pivot Chart kliu9 Excel VBA 3 October 13th, 2004 09:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.