Search code examples
vbapowerpointoffice-2013

Shape.Height and Shape.Width problems in PowerPoint 2013


I am using a small VBA script to apply some text in the background. The script works fine on PowerPoint 2007 and PowerPoint 2010.

However, in PowerPoint 2013, setting Shape.Height and Shape.Width has no effect. Here is the snippet of the code. Any help would be appreciated.

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

Solution

  • This is an issue with PowerPoint 2013.

    Workaround is to set

    Myshape.TextFrame2.WarpFormat = msoWarpFormat37
    

    Workaround is provided at http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/2c1cf339-aa90-4d82-9475-0ff5f49ac1b1/.