Shading rows in a PPT table using VBA

Posted on 2009-12-16
Last Modified: 2013-12-26
I am trying to find the syntax to shade certain rows in powerpoint table

There are currently multiple tables in a template that are automatically updated using vba, and sometimes the lists have different number of rows. the code that i use to currently populate the tables is below.

Case 1 - The cell that was just populated needs to have the background color changed to grey.

Any suggestions or ideas on how to do it are greatly appreciated...
Private Sub TableUpdate(strShapeName As String, iRowCount As Integer, iColCount As Integer, iColCopy As Integer, iRowCopy As Integer, bFormat As Boolean)

Dim rngFormat As Range

rngFormat = False

If bFormat = True Then

rngFormat = Range("nrTableFormattingStart")

i = 1   'Row Counter for Paste Section

j = 1   'column Counter for Paste Section

k = iRowCopy

l = iColCopy


    'Set oPPTShape = strShapeName


    Do Until i > iRowCount

        Do Until j > iColCount

                oPPTShape.Table.cell(i, j).Shape.TextFrame.TextRange.Text = Cells(k, l).Text

            Select Case rngFormat

            Case 0

            Case 1

                'shade the background of the cell grey

            Case 2

                'Merge the first 4 cells of the table


            Case Else

            End Select


            j = j + 1

            l = l + 1

            Set rngFormat = rngFormat.Offset(1, 0)




        i = i + 1

        k = k + 1

        j = 1

        l = iColCopy




End Sub

Open in new window

Question by:DekkaG
    LVL 23

    Accepted Solution


    opptshape.Table.Cell(i, j).Shape.Fill.ForeColor.RGB = RGB(175, 175, 175)

    Open in new window


    Author Closing Comment

    You are two for two. This also worked just right.


    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    This video teaches viewers how to add transitions to their Slideshows and how to set up timing for the transitions.
    The viewer will learn how to edit text. This includes Font, Spacing, Resizing, Color, and other special text options.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now