Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA in Word

Status
Not open for further replies.

anastasia

Programmer
Dec 13, 2000
111
GB
Hi,

I have a Word document which within it contains Text Boxes and a Table that I have inserted using Insert table and the Text Box drawing tool which Word provides on the toolbar, this text box has not been drawn using the VBA toolbar.

The problem is how do I in code refer to these text boxes etc. I can refer to text boxes created through the VBA toolbox as these have properties etc, but these text boxes do not, is there a way in which this is possible. I need to use these text boxes as the user has to paste in text. VBA text boxes will not let me paste in any text, the text just appears above the text box. Any ideas?.

The reason I am doing this is so that when a user pastes insome text into the text boxe(s), the text will then be formatted for them etc automatically.
But I have a problem whichever method I use.
 
The table will be in the document's tables collection and the text boxes (I think!) in the shapes collection.
 
Thanks StewartJ,

I have now the following code, just for practice.


Set objTable = ActiveDocument.Tables(1)
objTable.Rows(1).Range.Font.Bold = True
objTable.Rows(1).Range.Font.Size = 20

Set objTextBox = ActiveDocument.Shapes(3)
objTextBox.Bold = True

The table code works fine, no problems but the two lines above generate the error object does not support this property or method. I am using a text box that has been drawn on.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top