Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2007

Tip: Looking for answers? Try searching our database.

Adding a shadow to an inline picture

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
William Meisheid - 18 Jan 2007 23:30 GMT
I can manually add a shadow to an inline picture by selecting the picture and
using the Drawing toolbar, but when I record that action in a macro Word
writes into the code:

Selection.ShapeRange(1).Shadow.Type = msoShadow6 'the shadow type I chose

However, if I try to run the macro I get an error because Shadow is not a
property of ShapeRange, even though that is what the record macro tool saw
happen.

How do I code something that will allow me to programmatically add a shadow
to an inline picture?
Jay Freedman - 19 Jan 2007 01:53 GMT
As I wrote in
http://www.word.mvps.org/FAQs/MacrosVBA/ModifyRecordedMacro.htm, the
recorder sometimes records stuff that "just ain't so", and this is one
of those cases.

The only way to get the same effect in a macro that you get with one
button click in the UI is to convert the inline shape to a Shape
object, apply the shadow to that, and then convert back.

   Dim oShp As Shape
   Set oShp = Selection.InlineShapes(1).ConvertToShape
   oShp.Shadow.Type = msoShadow6
   oShp.ConvertToInlineShape

--
Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

>I can manually add a shadow to an inline picture by selecting the picture and
>using the Drawing toolbar, but when I record that action in a macro Word
[quoted text clipped - 8 lines]
>How do I code something that will allow me to programmatically add a shadow
>to an inline picture?
Jay Freedman - 19 Jan 2007 02:51 GMT
Incidentally, although in Word 2003 the statement

  Selection.InlineShapes(1).Shadow.Type = msoShadow6

causes an error "Method or data member not found", it works perfectly
in Word 2007. I guess now and then a bug fix actually slips in. :-)

--
Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

>As I wrote in
>http://www.word.mvps.org/FAQs/MacrosVBA/ModifyRecordedMacro.htm, the
[quoted text clipped - 29 lines]
>>How do I code something that will allow me to programmatically add a shadow
>>to an inline picture?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.