PDA

View Full Version : Add table to placeholder and setting table details



doubtfire
09-06-2017, 07:58 PM
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.:help

John Wilson
09-06-2017, 11:44 PM
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

doubtfire
09-07-2017, 09:05 AM
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 .....)