magnel
07-11-2015, 01:52 AM
Hello,
I am using PPT 2010, and I am trying to get a code which allows to fill defined rgb color in an autoshapes as well as tables.
After lots of searching and trying to merge many type of codes have come till this point, but still there is something that's giving error while compiling vba code.
Please can someone fill in the missing puzzle.
Sub Color()
Dim iCol As Integer
Dim iRow As Integer
Dim otbl As Shape
Dim oshpR As ShapeRange
ActiveWindow.Selection.ShapeRange.Select
On Error GoTo err
With ActiveWindow.Selection.ShapeRange 'Make use of the new object to access Glow for text
.Fill.Transparency = 0.25
.Fill.Visible = msoTrue
.Fill.ForeColor.rgb = rgb(205, 120, 35)
.Fill.BackColor.rgb = rgb(255, 255, 255)
.Fill.Patterned msoPatternLightUpwardDiagonal
End With
Exit Sub
err:
MsgBox "Select shapes with text!"
Set otbl = ActiveWindow.Selection.ShapeRange(1)
If otbl.HasTable Then
For iRow = 1 To otbl.Table.Rows.Count
For iCol = 1 To otbl.Table.Columns.Count
If otbl.Table.Cell(iRow, iCol).Selected Then
otbl.Table.Cell(iRow, iCol).Shape.TextFrame2.TextRange.Fill.Transparency = 0.25
otbl.Table.Cell(iRow, iCol).Shape.TextFrame2.TextRange.Fill.Visible = msoTrue
otbl.Table.Cell(iRow, iCol).Shape.TextFrame2.TextRange.Fill.ForeColor.rgb = rgb(205, 120, 35)
otbl.Table.Cell(iRow, iCol).Shape.TextFrame2.TextRange.Fill.BackColor.rgb = rgb(255, 255, 255)
otbl.Table.Cell(iRow, iCol).Shape.TextFrame2.TextRange.Fill.Patterned msoPatternLightUpwardDiagonal
End If
Next iCol
Next iRow
End If
End Sub
Thanks
I am using PPT 2010, and I am trying to get a code which allows to fill defined rgb color in an autoshapes as well as tables.
After lots of searching and trying to merge many type of codes have come till this point, but still there is something that's giving error while compiling vba code.
Please can someone fill in the missing puzzle.
Sub Color()
Dim iCol As Integer
Dim iRow As Integer
Dim otbl As Shape
Dim oshpR As ShapeRange
ActiveWindow.Selection.ShapeRange.Select
On Error GoTo err
With ActiveWindow.Selection.ShapeRange 'Make use of the new object to access Glow for text
.Fill.Transparency = 0.25
.Fill.Visible = msoTrue
.Fill.ForeColor.rgb = rgb(205, 120, 35)
.Fill.BackColor.rgb = rgb(255, 255, 255)
.Fill.Patterned msoPatternLightUpwardDiagonal
End With
Exit Sub
err:
MsgBox "Select shapes with text!"
Set otbl = ActiveWindow.Selection.ShapeRange(1)
If otbl.HasTable Then
For iRow = 1 To otbl.Table.Rows.Count
For iCol = 1 To otbl.Table.Columns.Count
If otbl.Table.Cell(iRow, iCol).Selected Then
otbl.Table.Cell(iRow, iCol).Shape.TextFrame2.TextRange.Fill.Transparency = 0.25
otbl.Table.Cell(iRow, iCol).Shape.TextFrame2.TextRange.Fill.Visible = msoTrue
otbl.Table.Cell(iRow, iCol).Shape.TextFrame2.TextRange.Fill.ForeColor.rgb = rgb(205, 120, 35)
otbl.Table.Cell(iRow, iCol).Shape.TextFrame2.TextRange.Fill.BackColor.rgb = rgb(255, 255, 255)
otbl.Table.Cell(iRow, iCol).Shape.TextFrame2.TextRange.Fill.Patterned msoPatternLightUpwardDiagonal
End If
Next iCol
Next iRow
End If
End Sub
Thanks