Text Boxes


ActiveDocument.Shapes.AddTextBox(msoTextOrientation, msoTextOrientation.Horizontal, left, top, width, height) 

all in points


For adding pictures and graphics, refer to Illustrations > VBA Code > Shapes


Reading Writing Text

When you read text from a textbox additional characters will be included in your text string.

Dim stext As String 
   stext = ActiveDocument.Shapes(1).TextFrame.TextRange.Text
   Debug.Print stext
   For ichar = 1 to Len(stext) Step 1
      Debug.Print Asc(Mid(stext, ichar,1)) & " - " & Mid(stext,ichar,1)
   Next ichar

Any spaces are represented by Chr(32)
At the end of the text there will also be a Chr(13)
To remove the carriage return at the end of the string you need to include the following:

stext = Repace(stext, Chr(13),"") 

Text boxes cannot have the same name if you are renaming using VBA
However testboxes with the same name can be inserted by inserting the same building block multiple times


The following line of code does not include any shapes in the headers or footers

ActiveDocument.Shapes 


© 2020 Better Solutions Limited. All Rights Reserved. © 2020 Better Solutions Limited TopPrevNext