dshrenik
asked on
Change color
Is there a feature in PowerPoint 2010 that allows the user to automatically change one color to another?
For example, I want all green text on my slide to become blue.
If yes, please give me a step by step procedure.
Thanks!
For example, I want all green text on my slide to become blue.
If yes, please give me a step by step procedure.
Thanks!
If your slides follow the master slide you can change the color there. If not using code is the only answer. Is the green the exact same green everywhere?
ASKER
It is the same everywhere. It does not follow the master slide. I changed colors manually.
You can update the Master Slide to get the font color schemes how you need it, then Close Slide Master. To apply this Master Slide font scheme to all the existing slides, select all of the slides (whether from the Slide Sorter view or from the left-side navigation pane), go to the Home tab, click the Reset button under the Slides section. This will, in one fell swoop, update all of the slides to be in accordance with what the Slide Master has set.
So that means updating the Slide Master with green font text (even if the fonts already in the Slide Master are not even blue) and then run the Reset I noted above.
^ I meant to note to change all the green font text to blue, not blue to green.... >_<
I tested this earlier with manually (different and various) set font colors for each of five different slides and I got them all to turn into blue font text after running the process I noted originally.
I tested this earlier with manually (different and various) set font colors for each of five different slides and I got them all to turn into blue font text after running the process I noted originally.
ASKER
@yobri: I'm a little confused. Could you give me a step by step procedure.
I have a single slide and I just want to transform all words with color A to color B.
Thanks!
I have a single slide and I just want to transform all words with color A to color B.
Thanks!
Go to View tab > Slide Master button.
Edit each text box on each slide here in the Slide Master with font color blue. Click into a text box, select all the text with your mouse, right-click and click on Font. Change the Font color paint bucket dropdown button and choose one of the blue colors (that you prefer). Do this for each text box in the Slide Master slides.
Once each slide has blue text in each, click the Close Master View button in the ribbon (under the Slide Master tab).
Go to the Home tab. In the Slides section, click the Reset button. All the text (in textboxes) in the file should turn blue accordingly.
Edit each text box on each slide here in the Slide Master with font color blue. Click into a text box, select all the text with your mouse, right-click and click on Font. Change the Font color paint bucket dropdown button and choose one of the blue colors (that you prefer). Do this for each text box in the Slide Master slides.
Once each slide has blue text in each, click the Close Master View button in the ribbon (under the Slide Master tab).
Go to the Home tab. In the Slides section, click the Reset button. All the text (in textboxes) in the file should turn blue accordingly.
ASKER
Well, I don't want all the text to turn into blue. I wont only those few words in green to turn blue.
All my text is in color A, expect for a few words here and there in color B. I want those words (B) to turn to color C.
All my text is in color A, expect for a few words here and there in color B. I want those words (B) to turn to color C.
If the green font is in the same places on each slide for which it appears, then you can only update the text boxes (to blue) in the Slide Master that you know would contain the green text...
The only other way to perform this selective green to blue for various text boxes in the document would employ a VBA attempt at a solution since the Find and Replace functions in Powerpoint are rather shallow...
The only other way to perform this selective green to blue for various text boxes in the document would employ a VBA attempt at a solution since the Find and Replace functions in Powerpoint are rather shallow...
ASKER
Would it be possible to do it with VBA?
I'll try to explore this tomorrow... that is, if no one else does so before then.
Try the following code which cycles around every slide and every shape and if the shape is either an autoshape or a textbox it checks each character for the color change. It may need tweaking as it is likely that the selection is too broad but try it ON A COPY of your file and let me know the errors / Omissions
You will need to know the color values for the from and to code but assuming for example they are vbred and vbgreen then call as
changetext vbred, vbgreen
to change red text to green text
Chris
You will need to know the color values for the from and to code but assuming for example they are vbred and vbgreen then call as
changetext vbred, vbgreen
to change red text to green text
Chris
Sub changeText(lngOldColor As Long, lngNewColor As Long)
Dim shp As Shape
Dim sld As Slide
Dim cnt As Long
For Each sld In ActivePresentation.Slides
For Each shp In sld.Shapes
If shp.Type = msoTextBox Or shp.Type = msoPlaceholder Then
For cnt = 1 To Len(shp.TextFrame.TextRange.Text)
If shp.TextFrame.TextRange.Characters(cnt, 1).Font.Color = lngOldColor Then
shp.TextFrame.TextRange.Characters(cnt, 1).Font.Color = lngNewColor
End If
Next
'ElseIf shp.Type = msoPlaceholder Then
End If
Next
Next
End Sub
ASKER
Do I enter it in Hex?
If the Hex code of the color is "0000B4", then do I just replace "lngOldColor" with "0000B4"?
If the Hex code of the color is "0000B4", then do I just replace "lngOldColor" with "0000B4"?
ASKER
How do I view the changes made by the macro? Will it happen automatically, as soon as I save it?
Noting your other question referred to tables, perhaps you have text in tables to process as well so the following adds tables to the process:
Chris
Chris
Sub changeText(lngOldColor As Long, lngNewColor As Long)
Dim shp As Shape
Dim sld As Slide
Dim cnt As Long
Dim rw As Integer
Dim col As Integer
For Each sld In ActivePresentation.Slides
For Each shp In sld.Shapes
If shp.Type = msoTextBox Or shp.Type = msoPlaceholder Then
For cnt = 1 To Len(shp.TextFrame.TextRange.Text)
If shp.TextFrame.TextRange.Characters(cnt, 1).Font.Color = lngOldColor Then
shp.TextFrame.TextRange.Characters(cnt, 1).Font.Color = lngNewColor
End If
Next
ElseIf shp.HasTable Then
For rw = 1 To shp.Table.Rows.Count
For col = 1 To shp.Table.Columns.Count
With shp.Table.Cell(rw, col).Shape.TextFrame.TextRange
For cnt = 1 To Len(.Text)
If .Characters(cnt, 1).Font.Color = lngOldColor Then
.Characters(cnt, 1).Font.Color = lngNewColor
End If
Next
End With
Next
Next
End If
Next
Next
End Sub
ASKER
Well, the text is in a Text Box
Could you tell me how the hex color code must be represented, and when I can expect to see the changes? Does the macro run automatically?
Could you tell me how the hex color code must be represented, and when I can expect to see the changes? Does the macro run automatically?
You have to run the macro for the changes to take effect. Add the following macro to force a specific change from your hex value to green ... the parameters prevent running via the dialog. Similarly replace vbgreen with a hex conversion as below:
val("&hABCDEF")
The hex value referred is entered as the long equivalent via the val function as below.
Chris
val("&hABCDEF")
The hex value referred is entered as the long equivalent via the val function as below.
Chris
sub testChangeText
changetext val("&h0000B4"), vbgreen
end sub
To run a macro ... having inserted it into a code module press alt + F8 from powerpoint and find the testChangeText, (or whatever you called it) sub and selelect it then click run.
Chris
Chris
ASKER
This is how my code looks like:
When I click F5, I get Run-time error. The specified value is ou of range.
When I click F5, I get Run-time error. The specified value is ou of range.
Sub changeText(lngOldColor As Long, lngNewColor As Long)
Dim shp As Shape
Dim sld As Slide
Dim cnt As Long
For Each sld In ActivePresentation.Slides
For Each shp In sld.Shapes
If shp.Type = msoTextBox Or shp.Type = msoPlaceholder Then
For cnt = 1 To Len(shp.TextFrame.TextRange.Text)
If shp.TextFrame.TextRange.Characters(cnt, 1).Font.Color = lngOldColor Then
shp.TextFrame.TextRange.Characters(cnt, 1).Font.Color = lngNewColor
End If
Next
'ElseIf shp.Type = msoPlaceholder Then
End If
Next
Next
End Sub
Sub ChangeColor()
changeText Val("&h0000B4"), vbGreen
End Sub
Can you supply a copy of your file, (remove sensitive data) that I can test since although it worked in my tests clearly there is something I missed and that needs sight of the document.
If you are concerned about this forum visibility, I have an email in my profile you can send it to and I will make sure the issue is identified in this thread without anything sensitive once it works for me.
Best however is posting a safe copy herein since then many experts can help!
Chris
If you are concerned about this forum visibility, I have an email in my profile you can send it to and I will make sure the issue is identified in this thread without anything sensitive once it works for me.
Best however is posting a safe copy herein since then many experts can help!
Chris
ASKER
It does not allow .pptm files to uploaded.
Can you gibe me email address?
Can you gibe me email address?
ASKER
I renamed the extension to .ppt (from .pptm)
Hope it works. EE.ppt
Hope it works. EE.ppt
Save as 97 PPT type and that should be allowed otherwise
Not allowed to place addy in a thread as these are searchable, but click my name ... this will display my profile, and the address can be gleaned therein as address@domain.com with both parts visible therein.
Chris
Not allowed to place addy in a thread as these are searchable, but click my name ... this will display my profile, and the address can be gleaned therein as address@domain.com with both parts visible therein.
Chris
ASKER
Does the file I just uploaded work you after renaming the extension?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great!
So 11796480 is RGB in decimals?
So 11796480 is RGB in decimals?
ASKER
Sorry, what exactly is that number?
That's the actual color of the font text that was colored blueish in the original file. I established what it was by direct read of the data within vba.
For what it's worth:
?val("&h0000B4")
180
i.e. nothing like the actual font color but it needs to pretty much exact although there is some potential to use a wild card that says blueish / redish if necessary.
Chris
For what it's worth:
?val("&h0000B4")
180
i.e. nothing like the actual font color but it needs to pretty much exact although there is some potential to use a wild card that says blueish / redish if necessary.
Chris
ASKER
But how do I get these numbers. i.e how do I convert from RGB to that number?
Is it just converting a hex no to decimal?
Is it just converting a hex no to decimal?
Conversion from RGB is as I showed ... what I suggest is teh hex value you provided was not the correct one for the text. For example how did you get the value h0000B4 that you supplied?
Chris
Chris
ASKER
That's the HTML code for that color.
So if my RGB values for my color are (230, 240, 250), how do I convert this to a form VBA understands?
So if my RGB values for my color are (230, 240, 250), how do I convert this to a form VBA understands?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great! Thank you so much!