VBA always creates linked chart even when using PasteExcelTable False, False, False in Office 2007

M

Matt Simpson

Hello,

I have a spreadsheet that I use to create a Word doc report that
containes a chart graph.

Using VBA, for each row in the spreadsheet, I copy the values of the
row to a separate sheet that has the chart. The values go into the
same cells every time and the chart references those cells. After
copying the values over to the sheet with the chart on it, the chart
is selected and then pasted into a new page in the Word document.

Then the next row of values is copied over to the chart sheet and the
new chart is copied and inserted into a new page in the word doc.

As you can see, I don't want that chart in Word to be linked to Excel
because the values that the chart references are being changed every
loop through the rows in excel.

Here is the code that does the copy and paste - this worked perfectly
in office 2003

Range("A1:I49").Copy
appWD.Selection.Paste
appWD.Selection.InsertBreak Type:=wdSectionBreakNextPage

However, in 2007, this results in a linked chart so that after the
macro is done, all charts on all pages of the word doc display the
same values - the values of the last row in Excel.

I have tried this code and found that the results are exactly the
same:

Range("A1:I49").Copy
appWD.Selection.PasteExcelTable False, False, False
appWD.Selection.InsertBreak Type:=wdSectionBreakNextPage

This makes sense but how do i paste it so that the chart itself is not
linked?

I could copy as picture, but the quality of the result is not as good
- it is just for printing though so I suppose I could go that way if I
have to.

Thanks!

Matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top