Resize-to-fit Table Columns (PowerPoint)
Resize-to-fit Table Columns (PowerPoint)
Resize-to-fit Table Columns (PowerPoint)
Below are my various attempts but they have failed as when I went to run my macro, the column widths did not change.
[code]mySlide.Shapes(mySlide.Shapes.Count).Table.Cell(x, y).Shape.TextFrame.WordWrap = msoFalse
mySlide.Shapes(mySlide.Shapes.Count).Table.Cell(x, y).Shape.TextFrame.AutoSize = ppAutoSizeShapeToFitText[/code]
[code]mySlide.Shapes(mySlide.Shapes.Count).Table.Columns (x).Width = ppAutoSizeShapeToFitText[/code]
[code]mySlide.Shapes(mySlide.Shapes.Count).Table.Cell(ta rgetRow, targetColumn).Shape.TextFrame.AutoSize = ppAutoSizeShapeToFitText[/code]
My solution!
I had much the same challenge as icu222much – wanting to use vba to automate the resizing of tables to match cell contents. My solution was to create (programmatically) a text box, put the text of the cell into the text box (together with font size and font name), resize the text box, get width and height of the text box, and use these values to set width and height of the cell in the table. Once all the cells are done, the text box is deleted.
Had thought of posting the code here, but it exceeds the limit on number of characters Is there a way to post vba code to this forum?
6
Cool Properties
I spent ages trying to find a property/method of the "autofit" type for table cells in powerpoint vba. Good to know that there is one. Quite a long way down the chain from the table cell object. I see there is also a boundheight property, for autosizing rows.
To the moderators: is there a way to make submitted vba code more legible, (preferrably with the same appearance as in the VB editor)?
6