magnel
04-13-2015, 01:23 PM
Hello,
I am using PPT 2010 and I am trying to find and replace colors of autoshapes on a given slide. We have the feature available in MS-Word to find and replace color but we do not have it PPT. Tried the below code, but there seems to be some problem.
Dim col() As Single
Sub copycol()
Dim oshp As Shape
Dim i As Integer
On Error GoTo err:
Set oshp = ActiveWindow.Selection.ShapeRange(1)
ReDim col(1 To oshp.Fill)
For i = 1 To oshp.Fill
col(i) = oshp.Fill(i)
Next i
Exit Sub
err:
MsgBox "Select Shape"
End Sub
Sub pastecol()
Dim oshp As Shape
Dim i As Integer
On Error GoTo err:
For Each oshp In ActiveWindow.Selection.ShapeRange(1)
ReDim Preserve col(1 To oshp.Fill)
For i = 1 To oshp.Fill
oshp.Fill(i) = col(i)
Next i
Next oshp
Exit Sub
err:
MsgBox "ERROR"
End Sub
Please can you help correct the code.
I am using PPT 2010 and I am trying to find and replace colors of autoshapes on a given slide. We have the feature available in MS-Word to find and replace color but we do not have it PPT. Tried the below code, but there seems to be some problem.
Dim col() As Single
Sub copycol()
Dim oshp As Shape
Dim i As Integer
On Error GoTo err:
Set oshp = ActiveWindow.Selection.ShapeRange(1)
ReDim col(1 To oshp.Fill)
For i = 1 To oshp.Fill
col(i) = oshp.Fill(i)
Next i
Exit Sub
err:
MsgBox "Select Shape"
End Sub
Sub pastecol()
Dim oshp As Shape
Dim i As Integer
On Error GoTo err:
For Each oshp In ActiveWindow.Selection.ShapeRange(1)
ReDim Preserve col(1 To oshp.Fill)
For i = 1 To oshp.Fill
oshp.Fill(i) = col(i)
Next i
Next oshp
Exit Sub
err:
MsgBox "ERROR"
End Sub
Please can you help correct the code.