Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-22-2019, 01:33 PM
bertelu bertelu is offline change forecolor all CMDbuttons Windows 10 change forecolor all CMDbuttons Office 2016
Novice
change forecolor all CMDbuttons
 
Join Date: Oct 2019
Posts: 3
bertelu is on a distinguished road
Default change forecolor all CMDbuttons

Hi, i do have a presentation with 10 commandbuttons (ActiveX control)


i can change vi VBA the forecolor of each button but i'm wondering if there is a more efficient way to change the forecolor (or any other properties) of a commandbutton (not the shapes) via a VBA code
a sort of lop that find all the buttons in the whole presentation

thanks
Reply With Quote
  #2  
Old 10-23-2019, 09:06 AM
bertelu bertelu is offline change forecolor all CMDbuttons Windows 10 change forecolor all CMDbuttons Office 2016
Novice
change forecolor all CMDbuttons
 
Join Date: Oct 2019
Posts: 3
bertelu is on a distinguished road
Default

hi all after a nigth spent i've found the solution

here the code

Private Sub change_font()
Dim pulsante As Shape
Dim sld As Slide
For Each sld In ActivePresentation.Slides
For Each pulsante In sld.Shapes
If pulsante.Name Like "CMD_*" Then
pulsante.OLEFormat.Object.ForeColor = &H400040
pulsante.OLEFormat.Object.BackColor = &HFFC0C0
End If
' pulsante.ForeColor = &H400040
Next pulsante
Next sld
End Sub
Reply With Quote
  #3  
Old 10-24-2019, 04:23 PM
JohnWilson JohnWilson is offline change forecolor all CMDbuttons Windows 10 change forecolor all CMDbuttons Office 2016
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,912
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

I would use this to check for a command button as name like"CMD_* can fail


Sub ChangeCOMM()
Dim oshp As Shape
Dim osld As Slide
For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
If oshp.Type = msoOLEControlObject Then
If oshp.OLEFormat.ProgID = "Forms.CommandButton.1" Then
oshp.OLEFormat.Object.BackColor = RGB(255, 0, 0) ' or whatever
End If
End If
Next oshp
Next osld
End Sub
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote
Reply

Tags
buttons, vba

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change and implement default theme font style change Nikko963 Word 5 05-04-2018 09:11 AM
change forecolor all CMDbuttons change formula based upon change of month invgrp2 Excel 7 05-03-2018 10:46 AM
Change computer's time, and all appointment times in Outlook's calendar change TimTDP Outlook 0 03-14-2017 06:56 AM
change forecolor all CMDbuttons How to change save location and file to print name change? albertc Excel Programming 1 05-13-2012 07:05 PM
change forecolor all CMDbuttons change the view to final, my change bars disappear. I need them visible anna.a.julin Word 1 03-01-2012 08:05 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:04 AM.


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