(Solved) – Choosing Shape via Input Box to change font

  • by
(solved)-–-choosing-shape-via-input-box-to-change-font

I’m trying to change the font of a user inputted Shape name however when I run the code nothing happens. Where am I going wrong please? Thank you, Jay

Sub Button3()

    Dim bpFontName As String
    Dim bpSize
    Dim bpItem As String

    bpFontName = InputBox("Please enter font", "font type", "Calibri")
        bpSize = InputBox("Please enter font size", "fontsize", "12")
        bpItem = InputBox("Please enter the shape name", "shapename", "TextBox 1")

    With ActivePresentation
        For Each Slide In .Slides
          On Error Resume Next
            For Each Shape In Slide.Shapes
                With Slide.Shapes("bpItem")
                    If .HasTextFrame Then
                        If .TextFrame.HasText Then
                            .TextFrame.TextRange.Font.Name = bpFontName
                            .TextFrame.TextRange.Font.Size = bpSize
                              If Err.Number = -2147188160 Then GoTo SkipSlide
                        End If
                    End If
                End With

            Next
        Next
    End With

SkipSlide:
    Err.Number = 0
ActivePresentation.SlideShowWindow.View.Next


End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *