Charts in Word

  • Thread starter Thread starter justin
  • Start date Start date
J

justin

I have pasted a chart from an Excel worksheet into a new
Word document using Excel VBA. I am now using the Word
macro recorder to build up code to then incorporate in the
Excel code to enhance the docuemnt before saving it.

I notice that when recording I cannot select the chart in
order to centre in in the document. Is this how it should
work or am I doing anything wrong and is there a way to
get around the problem.

Thanks
 
Hi Justin,

Not an easy question to answer, especially without having
seen your code, nor knowing which version of Word we're
dealing with?

Let me outline briefly how I'd approach the basic task
(import chart and "grab hold") and see if that gets you
anywhere

1. I try to avoid Copy/paste
2. To bring in an existing chart object, I'd probably
use the VBA equivalent of Insert/OBject/From file, which
would give me an object variable I could use to manipulate
the object. You'd want to record it in a macro, but very
roughly (pseudo-code) it would look like this:

Dim o_cht as Word.InlineShape

Set o_cht = ActiveDocument.InlineShapes.AddOLEObject ...
o_cht.Range.Paragraphs(1).Alignment = wdAlignParagraphCenter
I have pasted a chart from an Excel worksheet into a new
Word document using Excel VBA. I am now using the Word
macro recorder to build up code to then incorporate in the
Excel code to enhance the docuemnt before saving it.

I notice that when recording I cannot select the chart in
order to centre in in the document. Is this how it should
work or am I doing anything wrong and is there a way to
get around the problem.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep
30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow
question or reply in the newsgroup and not by e-mail :-)
 
Back
Top