Question : Create a graph in a Word doc from Access based on access table data

Hi
I have a graph/chart problem where I cannot find the proper, clean solution so far. Here is the setup:
- From Access, I create a Word doc in which there are a number of merge fields which I replace with data from tables in Access. This works fine
- Now in the Word doc, I'd like to add a chart/graph based on data on a table in Access

All the solutions i found either show how to do a graph on an Access report, or in an Excel sheet, and then copy it in Word. What I would like however, is:
- either create the graph directly in Word from my Access VBA code, and feed it the Access table data. I have however no idea how that should be done. it seems from the couple of macros I recorded that a graph in Word is an inline object fed from a file, which for me is not a "clean" solution
- or create the graph first in Access with the table data, and copy/paste it in Word. But here again, I found only example how to create a graph on an Access report as "base"

Questions:
- Isn't it possible to create directly a graph object in Access, WITHOUT any "base" object such as a report, and then to copy/paste it to Word ?
- Is it possible to feed data to an inline MS graph object in Word without creating the graph first as file ?
 - Is it necessary/best to go over the intermediary step of an Excel spreadsheet ?

In other words, what do you reckon the best solution is for my setup ?

Thanks for your help.
Bernard

Answer : Create a graph in a Word doc from Access based on access table data

That is strange but thanks cause I am using this as well and at some stage am going to get an error.  I will have to check why I do not.  I think that I have made a mistake in copying the code for you as I took out bits in and around this.

in any case I you do not need the select.  This below is enough to get the chart copied. Where Sheet 2 is the name of your sheet and Chart 1 is the name of your chart.



Application.Worksheets("Sheet2").ChartObjects("Chart 1").Chart.CopyPicture Appearance:=xlScreen, Size:=xlScreen, Format:=xlPicture

You can now shorten this based on what objects you have inialized.

Random Solutions  
 
programming4us programming4us