Anyone know the vba code to check if selected shape is filled.

Need code to pop up a message if the the selected shape isn't filled otherwise press on with the macro.

Parents
No Data
Reply
  • I'm looking at the X7 editor, but I think X4 will be the same. Please ask again if seems not to work.

    Assuming that your shape is s, then the fill type will be identified by s.fill.type  and the possible values (from the help file) are:

    cdrNoFill
    0
    Specifies no fill
    cdrUniformFill
    1
    Specifies uniform fill
    cdrFountainFill
    2
    Specifies fountain fill
    cdrPostscriptFill
    3
    Specifies PostScript fill
    cdrTextureFill
    8
    Specifies texture fill
    cdrPatternFill
    9
    Specifies pattern fill
    cdrHatchFill
    10
    Specifies hatch fill

    So I'd expect you should be able to do:

    if s.fill.type = cdrNoFill then
        msgbox "object has no fill"
    else
        ' whatever you want to do
    endif


Children