Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-25-2016, 11:09 AM
dh1sbg dh1sbg is offline VBA: How to change color of a CommandButton Windows 10 VBA: How to change color of a CommandButton Office 2016
Novice
VBA: How to change color of a CommandButton
 
Join Date: Aug 2016
Posts: 6
dh1sbg is on a distinguished road
Default VBA: How to change color of a CommandButton

Hi there,

I want to change the command-button color from red to green using VBA

I defined a variable as a shape and used this code

myShape.Fill.ForeColor.RGB = RGB(0,255, 0)

Well, it does not work, no changes so far.

Any Idea, what I did wrong?



Regards

Bruno
Reply With Quote
  #2  
Old 09-26-2016, 09:30 AM
JohnWilson JohnWilson is offline VBA: How to change color of a CommandButton Windows 7 64bit VBA: How to change color of a CommandButton Office 2010 32bit
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,912
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

Command Buttons are not Shapes and in this case you need to change the backcolor

Sub changeme()
Dim octrl As Object
'change slide number and name to suit
Set octrl = ActivePresentation.Slides(1).Shapes("CommandButton 1").OLEFormat.Object
octrl.BackColor = &HFF
End Sub


If you explain exactly what you are trying achieve there may be a better method
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote
  #3  
Old 09-27-2016, 12:44 AM
dh1sbg dh1sbg is offline VBA: How to change color of a CommandButton Windows 10 VBA: How to change color of a CommandButton Office 2016
Novice
VBA: How to change color of a CommandButton
 
Join Date: Aug 2016
Posts: 6
dh1sbg is on a distinguished road
Default This is, what I want to achieve

Hello there,

Thanks for your advise,

I want to have something like the radio buttons. 5 in a row

If I click on one of them, the color should change.

The problem with radio buttons is the layout: I can not use them, because the mark is not in the center of a square.

Regards

Bruno
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA: How to change color of a CommandButton CommandButton, 3 PCs with 3 different office(s) CYFire Excel Programming 1 12-13-2015 05:31 AM
VBA: How to change color of a CommandButton CommandButton random statu cromano Word VBA 7 06-13-2014 07:40 AM
VBA: How to change color of a CommandButton Email Document via Commandbutton aqhibjaveed Word VBA 1 03-25-2013 11:22 PM
VBA: How to change color of a CommandButton change One highlight Color to Another Redbarn Word VBA 1 03-16-2013 02:03 PM
color change for same shape ajkiran PowerPoint 1 11-10-2012 07:41 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:40 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft