Results 1 to 3 of 3

Thread: How do I add a shape object to a Powerpoint macro that resizes itself?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,887
    Location
    Maybe ...

    Sub AddTextBox()
        Dim oSlide As Slide
        Dim oShape As Shape
        Dim MyText As String
        Dim nWidth As Single
        MyText = InputBox("Enter text here")
    If Len(MyText) = 0 Then Exit Sub
        nWidth = ActivePresentation.SlideMaster.Width
        For Each oSlide In ActivePresentation.Slides
            With oSlide.Shapes.AddTextBox(msoTextOrientationHorizontal, 0, 0, nWidth, 30)
                .TextFrame.TextRange.Text = MyText
                .TextFrame.AutoSize = ppAutoSizeShapeToFitText
            End With
        Next
    End Sub

    Also, it's easier to read if you use the VBA tag insert box

    Paul
    Last edited by Aussiebear; 04-28-2023 at 08:39 PM. Reason: Adjusted the code tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •