Getting property values from shapes

M

Martin Stender

Hi all,

I need to read various properties from selected shapes on a slide, like
fore/backcolor and to check if the shape if opaque or transparent.

I got the basic functionality working, meaning I can read the selection
type, the number of selected shapes etc.

For instance, I can read the fill transparency value of a shape by
writing this:
'Sel.ShapeRange.Fill.Transparency'

But I can't seem to get the actual colors, be it foreColor or
backColor.
If I do the - to me - logical thing of writing
'Sel.ShapeRange.Fill.BackColor.RGB', I keep getting a weird value of
16777215 regardsless of which fillcolor the shape actually has.

How does one do this?
Thanks in advance
Martin
 
D

David M. Marcovitz

You are doing the right thing. The problem is that shape values are
stored as RGB numbers, not color names. The value that you are getting is
a 6 digit hexadecimal number that represents the amount of Red, Green,
and Blue in the shape. If you display the number as a 6 digit hexadecimal
number, you can probably look up the value on a chart. Also, if you just
want to compare to some standard colors, you can use the color names
(e.g., If myColor = vbYellow Then), but if the color is not exactly a
standard color, that won't work.
--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
M

Martin Stender

Thank you both! Thanks for the link, Steve.

What I first realized now, is that a solid fill color (which would be
the background-color on a shape) actually uses the foreColor property
.... I forgot I was in MS land... :)

Anyway, that value passed throught the function Steve linked to, gives
me exactly what I need.

Big thanks
Martin
 
M

Martin Stender

Oh - one more thing - off topic ...
I've searched high and low ... can it really be, that it is not
possible to programmatically set up guidelines?

This would make sense, since you can't lock guidelines and you can't
undo if you accidentally move one.

I've of course tried to record a macro while creating/dublicating
guides, but the generated macro is empty.

Any ideas?

Thanks in advance!
Martin
 

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