Minh Tiên > 09-06-21, 03:17 PM
Private Sub FormatTable()
Dim sFile As String
sFile = CurrentProject.Path & "\" & "TenSlide.pptx"
Dim ppApp As Object
Dim ppPres As Object
Dim ppSlide As Object
Dim oeff As Object
On Error Resume Next
Set ppApp = GetObject(, "PowerPoint.Application")
If Err.Number <> 0 Then
Err.Clear
Set ppApp = CreateObject("PowerPoint.Application")
End If
ppApp.Visible = False
Set ppPres = ppApp.Presentations.Open(FileName:=sFile, WithWindow:=msoTrue)
Set ppSlide = ppPres.Slides(1)
With ppSlide.Shapes(1).Table
'Ghi thông tin vào table:
.Cell(1, 1).Shape.TextFrame.TextRange.text = "Hello" 'Chạy OK
'Format chiều cao cho dòng 1:
.Rows(1).Height = 50 ' Chạy OK
'Format chiều cao cho cả Table:
.Height = 500 'Không format được. Nhờ ACE chỉ giúp đoạn này.
End With
ppPres.Save
' ppPres.Close
' ppApp.Quit
Set ppApp = Nothing
Set ppPres = Nothing
Set ppCurrentSlide = Nothing
End Sub
ongke0711 > 09-06-21, 04:44 PM
ppSlide.Shapes(1).Height = 300