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
Nazim Khan - Author Image

Nazim Khan (Author) 📞 +91 9536250020
[MBA in Finance]

Nazim Khan is an expert in Microsoft Excel. He teaches people how to use it better. He has been doing this for more than ten years. He is running this website (TechGuruPlus.com) and a YouTube channel called "Business Excel" since 2016. He shares useful tips from his own experiences to help others improve their Excel skills and careers.

Leave a Comment