VBA for Excel 2007 tutorial-insert WordArt in Excel sheet

VBA code to insert WordArt in Excel sheet

In this example, you will learn VBA code to add WordArt in to your current Excel worksheet. A shape is a member of the Shapes collection. To add a WordArt to Excel worksheet, you can use the AddTextEffect() method. The addTextEffect() has the following prototype:

AddTextEffect(Effect_type, Text,Font_Name,Font_Size,Font_Bold,Font_Itatic,Left,Top)

-The Effect_type argument represents the type of effect to be applied to the text. It can be msoTextEffect1, msoTextEffect2, msoTextEffect10, msoTextEffect11, msoTextEffect12, etc.
-Text: the text to display.
-Font_Name,Font_Size,Font_Bold,Font_Italic represent the font name, font size, font bold, and font italic(respectively) that are applied to the text.
-Left, Top represent the value of x-coordinate, y-coordinate of the text that will be displayed in the Excel sheet.

   To run this example VBA code, you will need a Form, and a CommandButton.

VBA for Excel: vba example code to insert WordArt in excel sheet
VBA code for this example:

Private Sub CommandButton1_Click()
    Worksheets(1).Shapes.AddTextEffect _
    PresetTextEffect:=msoTextEffect10, Text:="Excel", _
    FontName:="Courier New", FontSize:=40, _
    FontBold:=msoFalse, FontItalic:=msoFalse, Left:=50, _
    Worksheets(1).Shapes.AddTextEffect _
    PresetTextEffect:=msoTextEffect11, Text:="VBA", _
    FontName:="Arial", FontSize:=40, _
    FontBold:=msoTrue, FontItalic:=msoFalse, Left:=200, _
End Sub


This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.