K
kitkat
I read on a post on the MSForum website that if you want to reference a table
in a specific slide, you can do so by coding something along the lines of
"For any object that is a shape of type = 19--apparently that's what a table
is--, do such and such with it." I don't have Powerpoint 2007 and I'm not
sure if you can only do that sort of thing with the new version...Anyway,
I've got a macro that creates a new table each time the slide is run and so
it needs to include some sort of naming code so I can refer back to the table
once it's been created. My code so far (simple version) is below. If anyone
could suggest a particular code to name the newly created tables, I would be
ecstatic....
Public Sub create24rows()
Dim lRows As Long
Dim lCols As Long
Dim sTLeft As Single
Dim sTTop As Single
Dim sTWidth As Single
Dim sTHeight As Single
Dim oTbl As Table
' Rows/Cols set here
lRows = 4
lCols = 2
' Set the size you want for the table here
sTLeft = 150
sTTop = 150
sTWidth = 150
sTHeight = 150
' Add the table
Call ActivePresentation.Slides(13).Shapes.AddTable(lRows, lCols, sTLeft,
sTTop, sTWidth, sTHeight)
Set oTbl = ?!?!?! (This is where I need to figure out how to reference the
new table)
With oTbl
With .Cell(2, 1).Shape
With .TextFrame.TextRange
.Text = "Hope"
End With
End With
End With
End With
End Sub
in a specific slide, you can do so by coding something along the lines of
"For any object that is a shape of type = 19--apparently that's what a table
is--, do such and such with it." I don't have Powerpoint 2007 and I'm not
sure if you can only do that sort of thing with the new version...Anyway,
I've got a macro that creates a new table each time the slide is run and so
it needs to include some sort of naming code so I can refer back to the table
once it's been created. My code so far (simple version) is below. If anyone
could suggest a particular code to name the newly created tables, I would be
ecstatic....
Public Sub create24rows()
Dim lRows As Long
Dim lCols As Long
Dim sTLeft As Single
Dim sTTop As Single
Dim sTWidth As Single
Dim sTHeight As Single
Dim oTbl As Table
' Rows/Cols set here
lRows = 4
lCols = 2
' Set the size you want for the table here
sTLeft = 150
sTTop = 150
sTWidth = 150
sTHeight = 150
' Add the table
Call ActivePresentation.Slides(13).Shapes.AddTable(lRows, lCols, sTLeft,
sTTop, sTWidth, sTHeight)
Set oTbl = ?!?!?! (This is where I need to figure out how to reference the
new table)
With oTbl
With .Cell(2, 1).Shape
With .TextFrame.TextRange
.Text = "Hope"
End With
End With
End With
End With
End Sub