-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathReplaceColors.bas
29 lines (25 loc) · 1.08 KB
/
ReplaceColors.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
' function asks user to provide to RGB color
' first one is the old color to be replaced and second one is the new color to be used
Sub ReplaceColors()
Dim lFindColor As Long
Dim lReplaceColor As Long
Dim oSl As slide
Dim oSh As shape
Dim userColor As String
userColor = InputBox("Please enter old RGB color code to be replaced as 255,255,255", "Enter Color")
splittedUserColor = Split(userColor, ",")
lFindColor = RGB(CInt(splittedUserColor(0)), CInt(splittedUserColor(1)), CInt(splittedUserColor(2)))
userColor = InputBox("Please enter new RGB color code to be used as 255,255,255", "Enter Color")
splittedUserColor = Split(userColor, ",")
lReplaceColor = RGB(CInt(splittedUserColor(0)), CInt(splittedUserColor(1)), CInt(splittedUserColor(2)))
For Each oSl In ActivePresentation.Slides
For Each oSh In oSl.Shapes
With oSh
' Fill
If .Fill.ForeColor.RGB = lFindColor Then
.Fill.ForeColor.RGB = lReplaceColor
End If
End With
Next
Next
End Sub