VBA powerpoint - code to change cell shading in a table RRS feed

  • Question

  • I have spend a lot of time looking for the solution of my problem and now I have to ask here:

    • I have a powerpoint 2010 presentation, with a table on one slide.
    • I want to create a VBA modeless form that will work like a pallete of formats/clolours for formating cells of that table
    • Basically, the buttons on the form would just simulate clicking specific Shading color in Table Tools/Design menu


    1. I place the cursor to the cell

    2. then click on a button in activated modeless form

    3. the shading of that cell will change arrorcing to the color in the code

    The reason I want to do is, that some other people will use it and the colors must be easily accessible (also format painter doest not seem to copy the shading ) But I cannot find a way how to make this VBA code; I have tried recording macro in Word (not possible in PP) and looked up everything possible on the Internet combined with my skills, still no success.

    Saturday, December 6, 2014 8:22 AM


  • Hi jakub,

    To change the cell shading of a table, you could specify ForeColor to the Shape of the cell.

    For example:

    Dim t As Table
    Dim c As Cell
    Set t = Application.ActivePresentation.Slides(1).Shapes(3).Table
    Set c = t.Rows(1).Cells(3)
    c.Shape.Fill.ForeColor.RGB = RGB(255, 0, 0)

    If you want to get current cursor’s table, you could refer to this code:

    MsgBox ActiveWindow.Selection.ShapeRange(1).Table.Rows.Count

    Best Regards


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, December 8, 2014 7:38 AM