How to add a text box programmatically to another page using Microsoft.Office.Interop.Word

I can insert a text box into a Word document using the code below:

Dim opProcedures As Word.Shape
opProcedures = oDoc.Shapes.AddTextbox(Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationHorizontal, 0, 0, 456.75, 24.75)
opProcedures.TextFrame.TextRange.Text = "Operational Procedures"

This adds a text box to the first page of the document, however even when I change the first (top) parameter, I cannot move the text box to the second page (only lower to the 1st page, any larger values ​​than the height of the first page and disappear).

How can I get a text box on the second page of a document?

+3
source share
1 answer

You either have to specify the missing anchor parameter using the range that represents the text on page 2 (see the docs for AddTextBoxhere :)

http://msdn.microsoft.com/en-us/library/aa171543%28v=office.11%29.aspx

AddTextBox.

+1

All Articles