icu222much
Technical User
I am wondering how I am able to give my table a name after/while I am creating a table?
I have an existing powerpoint slide with several objects (mainly textboxes and simple shapes) in it. I would like to create a table with VBA, add an undetermined number of rows, and populate the table with data. When I run my code (see below) I get an error. I believe the problem is because I am not refering to the proper shape when trying to add rows/data to the table.
Here is the code I have so far. When I run it, I get the error "Shape (unknown member): Invalid request. This shape does not have a table".
Call ActivePresentation.Slides(1).Shapes.AddTable(lRows, lCols, sTLeft, sTTop, sTWidth, sTHeight)
ActivePresentation.Slides(1).Shapes(1).Table.Rows.Add
With ActivePresentation.Slides(3).Shapes(1).Table
.Cell(1, 1).Shape.TextFrame.TextRange.text = "A"
.Cell(1, 2).Shape.TextFrame.TextRange.text = "B"
.Cell(1, 3).Shape.TextFrame.TextRange.text = "C"
End With
I have an existing powerpoint slide with several objects (mainly textboxes and simple shapes) in it. I would like to create a table with VBA, add an undetermined number of rows, and populate the table with data. When I run my code (see below) I get an error. I believe the problem is because I am not refering to the proper shape when trying to add rows/data to the table.
Here is the code I have so far. When I run it, I get the error "Shape (unknown member): Invalid request. This shape does not have a table".
Call ActivePresentation.Slides(1).Shapes.AddTable(lRows, lCols, sTLeft, sTTop, sTWidth, sTHeight)
ActivePresentation.Slides(1).Shapes(1).Table.Rows.Add
With ActivePresentation.Slides(3).Shapes(1).Table
.Cell(1, 1).Shape.TextFrame.TextRange.text = "A"
.Cell(1, 2).Shape.TextFrame.TextRange.text = "B"
.Cell(1, 3).Shape.TextFrame.TextRange.text = "C"
End With