Option Explicit Private Sub Command1_Click() Dim appRef As New Illustrator.Application Dim frontDocument As Illustrator.Document Dim newAreaText As Illustrator.TextArtItem Dim areaTextRange As Illustrator.TextRange Dim lineOfText As Illustrator.TextLine Rem create a new text art item in the active layer of the frontmost document If (appRef.Documents.Count = 0) Then Set frontDocument = appRef.Documents.Add() Else Set frontDocument = appRef.ActiveDocument End If Rem set the color of the new text to blue frontDocument.DefaultStroked = False frontDocument.DefaultFilled = True Dim textRGBColor As New Illustrator.RGBColor Dim textColor As New Illustrator.Color textRGBColor.Red = 0 textRGBColor.Green = 0 textRGBColor.Blue = 255 textColor.RGB = textRGBColor Rem Create a new area text Set newAreaText = frontDocument.ActiveLayer.TextArtItems.Add newAreaText.Kind = aiAreaText newAreaText.Contents = "This is a test string to see how text flows through three boxes" Rem set the text style settings Set areaTextRange = newAreaText.TextRange areaTextRange.Size = 24 areaTextRange.Stroked = False areaTextRange.Filled = True areaTextRange.FillColor = textColor areaTextRange.Paragraphs(1).Justification = aiCenter Rem now create 3 text shapes that the text can flow inside Dim i As Integer Dim theLeft, theTop, theHeight, theWidth As Single Dim textPathPathRef As Illustrator.PathItem Dim textPathRef As Illustrator.TextPath Dim pointList As Variant For i = 1 To 3 theLeft = GetRandom() * 500 theTop = GetRandom() * 800 theWidth = GetRandom() * 100 + 40 theHeight = GetRandom() * 50 + 40 Rem an area text always has at least one path items associated, so don't create the first one If (i > 1) Then Set textPathRef = newAreaText.TextPaths.Add Else Set textPathRef = newAreaText.TextPaths(1) End If Set textPathPathRef = textPathRef.TextPathObject Rem Generate a list of corners for the rectangle pointList = Array(Array(theLeft, theTop - theHeight), _ Array(theLeft, theTop), _ Array(theLeft + theWidth, theTop), _ Array(theLeft + theWidth, theTop - theHeight)) Rem set the shape of the i'th text area textPathPathRef.SetEntirePath pointList Next End Sub Function GetRandom() As Single GetRandom = Rnd End Function