VBA Code to Insert a Word Art in Excel

VBA Code:

' VBA Code to Insert a WordArt in Excel

Sub InsertWordArt()
    Dim ws As Worksheet
    Dim wordArtShape As Shape
    
    ' Set the worksheet to work with
    Set ws = ThisWorkbook.Worksheets("Sheet1") ' Replace with the name of your worksheet
    
    ' Insert a WordArt shape
    Set wordArtShape = ws.Shapes.AddTextEffect(msoTextEffect1, "Your Text", "Arial", 24)
    
    ' Customize the WordArt shape properties
    With wordArtShape
        .Left = 100 ' Set the left position
        .Top = 100 ' Set the top position
        .Width = 200 ' Set the width
        .Height = 50 ' Set the height
    End With
    
    ' Format the WordArt shape
    With wordArtShape.TextFrame2.TextRange
        .Font.Bold = True ' Set bold font style
        .Font.Color.RGB = RGB(255, 0, 0) ' Set font color to red
        .ParagraphFormat.Alignment = msoAlignCenter ' Set text alignment to center
    End With
    
    ' Adjust other WordArt shape properties as needed
    
    ' Display a message
    MsgBox "WordArt has been inserted."
End Sub


Check All VBA Codes

Join Our Telegram Group techguruplus telegram group Join Our WhatsApp Group techguruplus whatsapp group

Leave a Comment