我正在使用一個小的VBA腳本在背景中應用一些文本。該腳本在PowerPoint 2007和PowerPoint 2010上正常工作。PowerPoint 2013中的Shape.Height和Shape.Width問題
但是,在PowerPoint 2013中,設置Shape.Height和Shape.Width不起作用。這是代碼片段。任何幫助,將不勝感激。
Public Sub applyWatermark()
Dim curDesign As Design
Set curDesign = ActivePresentation.Designs.Item(1)
Dim masterSlide As Master
Set masterSlide = curDesign.SlideMaster
Dim shape As shape
Set shape = masterSlide.Shapes.AddTextbox(msoShapeRectangle, 0#, 0#, 100#, 100#)
shape.TextEffect.Text = "Watermark"
' Setting height and width works fine on PPT 2010 but does not work on PPT 2013
shape.Height = 200
shape.Width = 300
shape.TextFrame2.WordWrap = msoTrue
shape.TextFrame2.WarpFormat = msoWarpFormat1
shape.Left = 200
shape.Top = 200
End Sub
您是否嘗試過在「Set shape = masterSlide.Shapes ...」中設置高度和寬度屬性?也許這會更可靠。 – 2013-06-01 01:13:54
我在msdn上發佈了這個問題,並得到了一個解決方法將warpFormat設置爲msoWarpForm37,並且工作。 – 2013-06-04 06:47:38