charts from Excel to Word

B

BorisS

I need something that will:

1) allow Excel to perform a bit of code
2) grab a resulting chart off of a page (will be a chart sheet, so only
thing on that page)
3) paste it into word (will place cursor at start of a table)
4) move to the right (effectively selecting the next cell of the word table)
5) go to Excel, allow it to run an iteration of the chart
6) grab and paste to word

There will be a limited number of iterations of the chart, but each cycle
needs to jump from Excel to Word for pasting.

Thanks for any help. I am totally new to the idea of having VB bounce
between apps, so any guidance along how to implement any code offered would
be most appreciated. I've done VB in each app separately, but not together.
 
C

Cindy M.

Hi Boris,
I need something that will:

1) allow Excel to perform a bit of code
2) grab a resulting chart off of a page (will be a chart sheet, so only
thing on that page)
3) paste it into word (will place cursor at start of a table)
4) move to the right (effectively selecting the next cell of the word table)
5) go to Excel, allow it to run an iteration of the chart
6) grab and paste to word

There will be a limited number of iterations of the chart, but each cycle
needs to jump from Excel to Word for pasting.
For the basics on how to control Word from within an Excel VBA project, or
vice versa, check the word.mvps.org website - you should find a couple of
articles to give you the basics.

It's always better to avoid using the Clipboard (copy/paste) unless there's no
alternative. For this job, there is another possible approach: insert a field
to LINK the chart from Excel into Word, then break the link.

To see this in action, select and copy a chart in Excel. In Word, Edit/Paste
Special and activate the "link" option. Now press Alt+F9 in the Word document
and you should see a LINK field. (or not, depends on the version of Word and
certain options. If you don't see it, I need to know which version of Office
you're working with.) You can use the contents of the field as the basis for
your code to do doc.Fields.Add. Very roughly
Dim fld as Word.Field
Set fld = doc.Fields.Add Text:="Content of the Link field"
fld.Unlink 'turn it into a static object

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

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

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