PPT.ConvertTextToSmartArt in MS PowerPoint 2010 to Convert Text into SmartArt in VB.NET

In this article I am going to explain about how to Convert Text into SmartArt in a Microsoft PowerPoint 2010 presentation.
  • 2892

Introduction

In this article I am going to explain about how to Convert Text into SmartArt in a Microsoft PowerPoint 2010 presentation. For this we use PPT.ColorFormat.Brightness in Microsoft PowerPoint 2010. Using PPT.ConvertTextToSmartArt we can convert text programmatically into different built-in SmartArt layouts. In this article I am also going to explain ow to create a list of all of the index values and smart art names in Microsoft PowerPoint 2010.

Using smart art in our presentation we make it more attractive and understandable. It is useful for both speaker and audience  of presentation.

Microsoft Office 2010 offer some powerful tools, using this tools you can create application. Using Microsoft Visual Basic for Applications (VBA) you can create your own application according to your need. These application can performer some specific task.

For creating application we can use

  • VBA host of Excel 2010
  • VBA host of PowerPoint 2010
  • VBA host of Word 2010

NOTE : OneNote 2010 is not a VBA host.

Code that we use in this application are given below

Sub ConvertToSmartArtLayoutTest() 

    Dim vip As Slide
    vip = ActivePresentation.Slides.Add(1, ppLayoutText)
    Dim shp As Shape
    shp = vip.Shapes(2)
 
    ' Create text with Main at the top level, and
    ' NW, NE, SW, SE as the four child paragraphs.

    Dim a As String
    a = "Main.NW.NE.SW.SE"
    a = Replace(Text, ".", vbCrLf) 

    ' Insert the text into the shape:

    With shp.TextFrame.TextRange.Paragraphs
        .Text = a
        .Lines(2).IndentLevel = 2
        .Lines(3).IndentLevel = 2
        .Lines(4).IndentLevel = 2
        .Lines(5).IndentLevel = 2

    End With 

    ' Now that the shape includes text that is appropriate
    ' for the smart art layout you'll use, convert it to
    ' the appropriate layout (121, Titled Matrix): 

    shp.ConvertTextToSmartArt(Application.SmartArtLayouts(121))

End Sub 

Sub CreateSmartArtList()

    Dim b As Integer
    For b = 1 To Application.SmartArtLayouts.Count
        Debug.Print(b, Application.SmartArtLayouts(b).Name)
    Next b

End Sub

Step for creating Application

Step 1 : Start Microsoft PowerPoint 2010 :

1.jpg

Step 2 : Using Alt + F11 Key Start Visual Basic for Applications (VBA) Window :

2.jpg
 

Step 3 : Select on VBAProject(Presentation 1) :

3.jpg
 

Step 4 : Right Click On VBAProject(Presentation 1) ==> Goto Insert==> Goto Module & click on Module:

4.jpg
 

Step 5 : Write Code in Visual Basic for Applications (VBA) Window :

Clipboard06.jpg
 

Step 6 : Run Application using F5 :

Step 7 : Macros window will open, Select Macros name and click on Run Button :

Clipboard02.jpg

Step 8 : Output of Application

Clipboard04.jpg
 

Step 9 : Now click on SmartArtTools in your PowePoint Here you can change Layout of smartArt :

Clipboard021.jpg

Step 10 : Here you can change Color of smartArt :

Clipboard041.jpg

Step 11 : Here you can change Style of smartArt :

Clipboard061.jpg

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.