2013-11-01 1 views
0

VBA 매크로를 사용하여 PPT 테이블의 셀 가운데에 그래픽을 배치하고 싶습니다. 이 그래픽은 동영상 시작을위한 버튼으로 작동해야합니다.VBA를 사용하여 PPT 테이블에 그래픽 배치

Example of table

는 지금은이 개 질문이 :

  1. 어떻게 내가 PPT를 어떻게 알 수 있습니까
  2. 는 미리 정의 된 그래픽을 사용하는 셀에 그래픽을 배치 할 수 있습니다를

또는 셀을 클릭하여 애니메이션을 시작하는 더 좋은 방법이 있습니까?

답변

0
Sub table_with_button() 

    Dim PR As Presentation 
    Dim FOL As Slide 
    Dim xx, yy, dx, dy As Integer 
    Dim Bild, tabelle As Shape 
    Dim video As String 

    Set PR = ActivePresentation 
    Set FOL = PR.Slides.Add(PR.Slides.Count + 1, ppLayoutBlank) 

    ' create table 
    Set tabelle = FOL.Shapes.AddTable(NumRows:=2, NumColumns:=2, _ 
         Left:=cm2Points(1), Top:=cm2Points(1), _ 
         Width:=cm2Points(5), Height:=cm2Points(5)) 

    ' get position of table cell 
    xx = tabelle.Table.Cell(2, 2).Shape.Left 
    yy = tabelle.Table.Cell(2, 2).Shape.Top 
    dx = tabelle.Table.Cell(2, 2).Shape.Width 
    dy = tabelle.Table.Cell(2, 2).Shape.Height 

    ' insert button 
    Set Bild = FOL.Shapes.AddShape(msoShapeActionButtonForwardorNext, xx, yy, _ 
      dy * 0.5, dy * 0.5) 

    ' move button to cell center 
    Bild.Left = xx + (dx/2) - (Bild.Width/2) 
    Bild.Top = yy + (dy/2) - (Bild.Height/2) 

    ' insert hyperlink 
    video = "c:\video.avi" 
    Bild.AlternativeText = video 
    Bild.ActionSettings(ppMouseClick).Hyperlink.Address = video 

End Sub 

Function cm2Points(inVal As Single) 
    cm2Points = inVal * 28.346 
End Function 

Function Points2cm(ByVal inVal As Single) 
    Points2cm = inVal/28.346 
End Function 
관련 문제