I am able to insert a textbox into a Word document using the below code:
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 textbox to the first page of the document however even when I change the first (top) parameter I am unable to move the textbox onto the second page (only lower down onto the 1st page, any greater values than the height of the first page an it disappears).
How can I get the textbox to appear on the 2nd page of the document?
You either have to provide the missing anchor parameter, using a range which represents a text on the 2nd page (see the docs for AddTextBox here:)
http://msdn.microsoft.com/en-us/library/aa171543%28v=office.11%29.aspx
or you have to move the active selection to the second page before calling AddTextBox.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With