2013-03-06 100 views
1

我想要做的幾件事情到演示文稿在PowerPoint 2013:更改字體/段落間距/更改幻燈片大小VBA簡報2013

  • 改變字體的所有文字爲「宋體」大小53,粗體
  • 變化段落間距之前爲0
  • 改變幻燈片大小,以27.508 X19.05釐米

這是我有:

Sub use() 

Dim oSl As Slide 
Dim osh As Shape 
For Each oSl In ActivePresentation.Slides 
    For Each osh In oSl.Shapes 
     If osh.HasTextFrame Then 
     With osh.TextFrame.TextRange 
      .ParagraphFormat.Alignment = ppAlignCenter 
      .ParagraphFormat.SpaceBefore = 0 
     End With 
     With osh.TextFrame.TextRange 
      With .Font 
      .Name = "Times New Roman" 
      .Italic = False 
      .Size = "53" 
      End With 
     End With 
     With ActivePresentation.PageSetup 
     .SlideHeight = 19.05 
     .SlideWidth = 27.508 

     End If 
Next 
Next ' slide 

End Sub 
+0

什麼不起作用? – 2013-03-06 11:09:55

+0

它沒有做它應該做的事情....我可以想出它 – 2013-03-06 11:17:14

+0

你必須描述什麼沒有工作... – 2013-03-06 11:22:04

回答

1

這裏是其工作方式希望最終版本:

Sub use() 

Dim s As Slide 
Dim shp As Shape 


For Each s In ActivePresentation.Slides 

    For Each shp In s.Shapes 
     If shp.HasTextFrame Then 
      With shp 
      .TextFrame.TextRange.Font.Name = "Times New Roman" 
      .TextFrame.TextRange.Font.Size = 53 
      .TextFrame.TextRange.Font.Bold = True 

       With .TextFrame.TextRange 
       .ParagraphFormat.SpaceBefore = 0 
       End With 

      End With 
      With ActivePresentation.PageSetup 
      .SlideWidth = 779.754330709 
      .SlideHeight = 540 
      End With 

     End If 
    Next shp 

Next s 
End Sub