Merging Cells in a PowerPoint Table

Posted on 2009-12-16
Last Modified: 2013-12-26
I am trying to find the syntax to merge cells in certain rows in a 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 2 - The cell that was just populated needs to have the first 4 cells (including itself) merged.

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

    Assuming i and j are the start row and column the code would be

    With opptshape.Table
    .Cell(i, j).Merge MergeTo:=.Cell(i, j + 3)
    End With

    Open in new window


    Author Closing Comment

    This was exactly what I was looking for. Thanks for the help.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Setting the Scene PowerPoint is a creative tool in the right hands but it also includes a much underutilised programming dimension. In this beginner level article, we're going to show you some of some key elements of programming PowerPoint using th…
    Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
    This video teaches viewers how to fit pictures into slides, crop and remove backgrounds, and alter photos to look more professional.
    The viewer will learn how to edit the master slide. They will also learn how to combine multiple themes into one master slide to use them in their presentation.

    759 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

    7 Experts available now in Live!

    Get 1:1 Help Now