Table coloring macro - problem

  • Thread starter Thread starter vvskpk
  • Start date Start date
V

vvskpk

Hi

I'm using powerpoint 2003.

I have created a macro with button which fills color to the objects. Now I
would like to add a feature to it. That is, if I select the table and click
the same macro, it should fill that color only to the table header and the
same color should apply to the table only to the middle horizontal lines
between rows with 0.75 (3/4) thickness. Here is my script to fill color for
shape and I tried to add the table feature. But the macro is angry with me.
Don't know how to add the feature to fill table header and middle lines. Same
macro if I use it for shape it should fill the object. If I use it for table
it should work only for the table properties. If not possible, please suggest
a new method.

I'm hoping the experts inside here can help!! Many thanks in advance...

Sub F114199231()
With ActiveWindow.Selection.ShapeRange
.Fill.Visible = msoTrue
.Fill.ForeColor.RGB = RGB(114, 199, 231)
.Fill.Solid
ActivePresentation.ExtraColors.Add RGB(Red:=114, Green:=199, Blue:=231)
ActiveWindow.Selection.ShapeRange.Line.Visible = msoFalse
End With
Dim otbl As Table
Set otbl = ActiveWindow.Selection.ShapeRange.Table
With otbl.Rows(1)
..Fill.Visible = msoTrue
Fill.ForeColor.RGB = RGB(114, 199, 231)
.Fill.Solid
ActivePresentation.ExtraColors.Add RGB(Red:=114, Green:=199, Blue:=231)
End With
End Sub

vvskpk
 
Hi Steve,

Thanks for the reply. Firstly, I don't see any message popping up when this
code is run with the object selected. I don't know what I'm missing.
Secondly, it will be a great help if you can tell how to fill the table
header and give middle colored lines using script. I can use it as a seperate
macro atleast. But if you can include both in the same (shape and table), it
will be really great.

Thanks again and again.
 
WOW. Amazing. You are genius. You are GOD.
I tried with it and it is working. But I'm uanble to add filling shape
script as it says "End If without Block If". I dont know what I'm missing. I
will try but feel happy if you can give that too...

many many many thanks
 
This is what I entered which is not working

......
Else
If .HasDiagram Then
Debug.Print "No table here"
With ActiveWindow.Selection.ShapeRange
.Fill.Visible = msoTrue
.Fill.ForeColor.RGB = RGB(114, 199, 231)
.Fill.Solid
ActivePresentation.ExtraColors.Add RGB(Red:=114, Green:=199,
Blue:=231)
ActiveWindow.Selection.ShapeRange.Line.Visible = msoFalse
End With
End If
End With
End Sub
 
Very sorry...ignore my previous entry...here is the script i tried but no
result. There are no errors but the shape is not getting filled. For table it
is working
fine, I need for the shape. Don't know where I messed up.
".......
End If
If .HasDiagram Then
Debug.Print "this is a shape"
With ActiveWindow.Selection.ShapeRange
.Fill.Visible = msoTrue
.Fill.ForeColor.RGB = RGB(255, 0, 0)
.Fill.Solid
ActivePresentation.ExtraColors.Add RGB(Red:=255, Green:=0,
Blue:=0)
ActiveWindow.Selection.ShapeRange.Line.Visible = msoFalse
End With
Else
Debug.Print "No shape or table"
End If
End With
End Sub



===================
 
Back
Top