loop through linked Excel charts and set size?

G

Gary

I have several linked Excel charts in a word document. I would like to loop through each chart and apply the following sizing statement

Selection.ShapeRange.ScaleWidth 0.90, msoFalse, msoScaleFromBottomRigh

Does anyone have a snipit of code that loops through each linked Excel chart in a document
Thanks, Regards
Gar
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?R2FyeQ==?=,
I have several linked Excel charts in a word document. I would like to
loop through each chart and apply the following sizing statement:
Selection.ShapeRange.ScaleWidth 0.90, msoFalse, msoScaleFromBottomRight

Does anyone have a snipit of code that loops through each linked Excel chart in a document?
Basically, you'd use

For Each shp in ActiveDocument.Shapes
shp.ScaleWidth 'ect.
next shp

But if your document might have other graphical objects with text flow
formatting, then you'd want to check a couple of other things:
1. Is the shp.type = msoEmbeddedOLEObject
2. If yes, is the shp.OLEFormat.Class = "Excel.Chart.8"

Note: Excel.Chart.8 should work for Office 97 through 2003, since the basic
format has not changed. But you may want to check if this is the class being
used in your documents: MsgBox shp.OLEFormat.Class will tell you.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
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