How to set (named) picture style for an InlineShape?

  • Thread starter Jeff Pek \(Autodesk\)
  • Start date
J

Jeff Pek \(Autodesk\)

Hi all -

Word 2007:
We're not finding a way to programmatically insert an InlineShape, AND apply
a named picture style (e.g., "Drop Shadow Rectangle"). Trying to record a
macro and doing this results in an empty macro.

I've looked all through the object model reference, but so far I can't find
any way to do this.

Is this possible?

Thanks,
Jeff
 
D

Doug Robbins - Word MVP

There are 43 different types of shadow that can be applied to an inlineshape
using code similar to

ActiveDocument.InlineShapes(1).Shadow.Type = msoShadow#

where # is a number between 1 and 43

I am not sure which one it is that you want.



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
C

Cindy M.

Hi Jeff,
Word 2007:
We're not finding a way to programmatically insert an InlineShape, AND apply
a named picture style (e.g., "Drop Shadow Rectangle"). Trying to record a
macro and doing this results in an empty macro.

I've looked all through the object model reference, but so far I can't find
any way to do this.
If I'm understanding you correctly:
Dim ils as Word.InlineShape
Set ils = ActiveDocument.InlineShapes.AddPicture(' get the necessary
parameters from the object model help)
ils.Range.Style = "Drop Shadow Rectangle"

Note that I'm interpreting your question literally and treating this like a
paragraph style name. If you mean something else, you have to be much more
specific about "named picture style" (like, where you're getting it from).

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 :)
 
J

Jeff Pek \(Autodesk\)

Hi Doug -

Please see my response to Cindy's post for more info. The whole point of
doing this is so that we can use one of the pre-named Picture Styles, which
embodies several shape styles together.

Thanks,
Jeff
 
C

Cindy M.

Hi Jeff,
This is what I tried, but the "Drop Shadow Rectangle" isn't a
paragraph style, so that code doesn't work.
What I want is to apply a "Picture Style" -- one of the styles that's shown
on the Format tab when the picture is selected.
OK, now I know what you're seeing.

I'm fairly sure this is part of the new graphics engine ("Escher") introduced
in Office 2007. As far as I know, a lot of this stuff hasn't been made
available in the object models for Office 2007. And there's a big chunk of it
that hasn't been implemented in Word (as opposed to PowerPoint).

The PowerPoint newsgroup is probably your best source of information, as they
were most closely involved with the testing (and thus with the MSFT team
responsible) during Beta. They can tell you whether there's anything available
in the object model.

If there's not, then the only way you'll have to do this is to use OpenXML.
The creation of graphics objects using OpenXML is supposedly fully supported.
You should find more information at OpenXMLDeveloper.org

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