TrippyTom
07-10-2006, 10:49 AM
Hi all,
How do I add a table and give it a name in VBA so I can change that specific table's column and row properties for the border colors?
I tried using the .addtable feature, but it's not allowing me to name it. Should I be doing it a different way?
Thanks in advance,
TT
Here's my code:
Sub myTable()
Dim mySlide As Integer
Dim sh As Integer
Dim myCol As Variant
mySlide = ActiveWindow.View.Slide.SlideIndex
ActivePresentation.Slides(mySlide).Shapes.AddTable NumRows:=3, _
NumColumns:=4, Left:=50, Top:=300, Width:=100, Height:=100
'Currently, this affects any table in the current slide. I would like
'to make it only affect the table I just added by somehow naming it.
With ActivePresentation.Slides(mySlide)
For sh = 1 To .Shapes.Count
If .Shapes(sh).HasTable Then
For Each myCol In .Shapes(sh).Table.Columns
myCol.Width = 50
Next myCol
End If
Next
End With
End Sub
How do I add a table and give it a name in VBA so I can change that specific table's column and row properties for the border colors?
I tried using the .addtable feature, but it's not allowing me to name it. Should I be doing it a different way?
Thanks in advance,
TT
Here's my code:
Sub myTable()
Dim mySlide As Integer
Dim sh As Integer
Dim myCol As Variant
mySlide = ActiveWindow.View.Slide.SlideIndex
ActivePresentation.Slides(mySlide).Shapes.AddTable NumRows:=3, _
NumColumns:=4, Left:=50, Top:=300, Width:=100, Height:=100
'Currently, this affects any table in the current slide. I would like
'to make it only affect the table I just added by somehow naming it.
With ActivePresentation.Slides(mySlide)
For sh = 1 To .Shapes.Count
If .Shapes(sh).HasTable Then
For Each myCol In .Shapes(sh).Table.Columns
myCol.Width = 50
Next myCol
End If
Next
End With
End Sub