Results 1 to 6 of 6
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Refencing Shapes Fill Style in code (Win 2KPro, Office2KPro)

    This may be easy but I'm having a little trouble.

    I have a complex map with a bunch of counties (msoFreeForm shapes) and some are filled white, some filled with a particular color, and others filled with a gradiant. What I want to do is run thru all the shapes and, if the shape DOES NOT use a gradient fill, specify a solid color fill. I can't find the method for testing whether a shapes is or is not using a gradient fill.

    Any suggestions?

    TIA!

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Refencing Shapes Fill Style in code (Win 2KPro, Office2KPro)

    Have you looked at the value of Shape.Fill.GradientStyle (This is from Word 2002, I assume it is the same for Word 2000)

    StuartR

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Refencing Shapes Fill Style in code (Win 2KPro, Office2KPro)

    actually i have put together code that checks for a particular type of gradient (e.g. msoGradientFromCenter) and that does work. i was wondering if there is a more generic 'Gradient [any style] True/False' but, at the moment, I can get what i need to get done done.

  4. #4
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Refencing Shapes Fill Style in code (Win 2KPro, Office2KPro)

    Trial and error suggests that the GradientStyle for an object with no Gradient returns -2, which is msoGradientMixed. I assume this is also what you would get if you had a number of objects with different styles selected.

    StuartR

  5. #5
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Refencing Shapes Fill Style in code (Win 2KPro, Office2KPro)

    great -- thanks for helping. the particular graphic i am working with has either solid fills or gradient center fills but it's nice to know how to handle a more complex scenario.

  6. #6
    Star Lounger
    Join Date
    Jun 2002
    Posts
    98
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Refencing Shapes Fill Style in code (Win 2KPro, Office2KPro)

    If Selection.ShapeRange.Fill.GradientVariant > 0 Then MsgBox "Gradient!"
    __________________________________________________ ____
    <img src=/S/nun.gif border=0 alt=nun width=20 height=20> Sister Dory
    Our Lady of Perpetual Help, Holstein Falls, Wisconsin, USA

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •