Placing a shape in a temp variable

F

flying_pig

This has probably been answered before but I can't find an appropriate search
string. Anyway here is the simple question:

I have a macros that gets the clicked-on shape which I then use to it change
a specific color.
What I then want it to do is when I click on another shape the new shape
changes to the specific color and the previous shape reverts back to its
original color.

Part of my macro as an attempt to do this is here...

Sub GetCurrentKey(CurrentKey As Shape)

CurrentKey.Fill.ForeColor.RGB = RGB(180, 180, 180) ' the new color
' PreviousArcKey = ActivePresentation.Slides(1).Shapes(CurrentKey) ' an
attempt to put the current shape into a temporary shape variable (declared
elsewhere).
..
..
..
End Sub

Clearly this is the incorrect syntax for the equation and maybe not the
right approach. Can anyone help please?
 
D

David M. Marcovitz

This has probably been answered before but I can't find an appropriate
search string. Anyway here is the simple question:

I have a macros that gets the clicked-on shape which I then use to it
change a specific color.
What I then want it to do is when I click on another shape the new
shape changes to the specific color and the previous shape reverts
back to its original color.
Wouldn't something simple like:

Set PreviousArcKey = CurrentKey

do what you want? Your CurrentKey and PreviousArcKey are objects, not
simple variables so you need the Set. Alternatively, you could have
PreviousArcKey be a String and just store the name:

PreviousArcKey = CurrentKey.Name

Then, you can have something like:

ActivePresentation.Slides(1).Shapes(PreviousArcKey).Fill.ForeColor...

--David
 
F

flying_pig

David,

Thanks for the reply. Of the solutions the 'Set' seems to be the simplest
for my purposes thanks.

Bob
 

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