Using VBA to Recolor Navigation Button Images

Hi Experts,

Just trying to do something a little snazzy for this workbook, basically I'm calling for an image to recolor to grayscale or normal depending upon the activated sheet.

How does this the attached workbook look and can you change anything to give the images/buttons more of a "depressed button" appearance?

PS use the buttons to switch sheets not the worksheet tabs to get a feel for the behavior.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
I believe you'd need to have two sets of images with one indicating it's active and the other not. You (or I) could probably use Photoshop to create the inactive set from your two images.
-PolakAuthor Commented:
I'm pretty happy with the simplicity of just using msoPictureGrayscale and msoPictureAutomatic.... are you sure that there isn't something that could be done to create a border around the image, with rounded corners, and modify the light angle to make it look depressed?
Martin LissOlder than dirtCommented:
There are a lot of things you can do. Enter design mode and right-click on one of the images and then select 'Size and Properties'. You'll find settings there for such things as 'Shadow', 'Reflection' and '3D'.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

-PolakAuthor Commented:
I did mess around in there a bit, but didn't continue because I was concerned that VBA wouldn't have the necessary language to modify the shape with gradients/transparency/etc... (at least not from Record Macro). I've messed around with 3D Light Angle before on shapes, but not much else... Is everything and anything possible?
Martin LissOlder than dirtCommented:
Here is what I'd do. I added two new shapes, one on top of the other, one of them "glowing" just to show a different version of the same shape. I also added code in 3 places all marked with 'new. Note that one of them turns off your color swap code for the purposes of this demo. Click the command button several times.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
-PolakAuthor Commented:
Glow, now there's an idea! Do you have any opposition to me just adding this to the UpdateButtonColor Sub? (Versioning issues?)
Sub UpdateButtonColor()
    'change color of any shape begining with "BT" & the ActiveSheet Name
    For Each shp In ActiveSheet.Shapes
        If Left(shp.Name, 5) = "BT" & Left(ActiveSheet.Name, 3) Then
            shp.PictureFormat.ColorType = msoPictureGrayscale
            shp.Glow.Color.ObjectThemeColor = msoThemeColorAccent2                                                                                                                                                        
            shp.Glow.Color.TintAndShade = 0
            shp.Glow.Color.Brightness = 0
            shp.Glow.Transparency = 0.6000000238
            shp.Glow.Radius = 8
        ElseIf Left(shp.Name, 2) = "BT" Then
            shp.PictureFormat.ColorType = msoPictureAutomatic
            shp.Glow.Radius = 0
        End If
End Sub

Open in new window

Also, other than activating a blank worksheet on workbook open, do you have any better suggestion for not having any buttons "active" on workbook open.
Martin LissOlder than dirtCommented:
You've most likely tested that code, so if it does what you want then go for it. I don't however know what you mean by "versioning issues".

As for not having any buttons "active", did you see what I did in my Workbook_Open?
-PolakAuthor Commented:
Ala, does "msoThemeColorAccent2" mean the same color in Excel 2010 as it does in Excel 2013...
No I didn't see that, certainly an advantage of doing it it your way vs. mine.
Martin LissOlder than dirtCommented:
does "msoThemeColorAccent2" mean the same color in Excel 2010 as it does in Excel 2013
Sorry but I don't have any idea.
-PolakAuthor Commented:
While I didn't end up approaching it from the hidden vs show solution; your method did point me in the right direction just by using the term "glow" so thank you!
Martin LissOlder than dirtCommented:
You're welcome and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2015
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.