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

Join the TechGuruPlus Telegram group

Join Our WhatsApp Group

Join the TechGuruPlus WhatsApp group
Nazim Khan, founder of TechGuruPlus.com

— Founder & Editor, TechGuruPlus.com
[MBA in Finance]

Nazim Khan has spent over ten years working with Excel, Tally and office documentation in accounts, finance and MIS roles. He has been running TechGuruPlus.com since 2016, where he publishes free editable templates for office work, and the YouTube channel Business Excel. He has trained more than 50,000 people online. Every template on this site is built and checked by him before it is published.

Contact  Â·  Excel Course

Leave a Comment