Consulting

Results 1 to 3 of 3

Thread: Add table to placeholder and setting table details

  1. #1

    Add table to placeholder and setting table details

    I know how to add table to content placeholder. Is it possible to use VBA to add table with certain columns/rows, fill different data on each cell and merge cells if data is longer rather wrapping text (no change on size of cell)?
    Any details you can share can be valuable to me. Thanks.

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    Some clues to adding tables

    Merging if text s too long would be trick but you can compare the boundwidth of the text with the cell width to see if it is needed and take action.

    Sub addTBL()Dim osld As Slide
    Set osld = ActiveWindow.View.Slide
    With osld.Shapes.AddTable(NumRows:=4, NumColumns:=4)
    .Table.Cell(1, 1).Shape.TextFrame.TextRange = "Row 1"
    .Table.Cell(1, 2).Shape.TextFrame.TextRange = "Row 2 and there's more"
    MsgBox .Table.Cell(1, 2).Shape.TextFrame.TextRange.BoundWidth & ">> " & .Table.Cell(1, 2).Shape.Width
    End With
    End Sub
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    John,

    Thanks for the surprisingly fast reply. I would test as supplied. We are just two years apart and your posts is ten times more than mine. Salute Guru and you're very closed to be a VBAX Guru ... (I might be back for more questions .....)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •