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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word OLE

Status
Not open for further replies.

TidyTrax

Programmer
Jul 11, 2001
263
0
0
AU
How to i populate a Text Box in a word document from visual basic - i've added the libray can open the file but its the referencing the txt box im stuck on - any help would be greatly appreciated
 
Try:

Code:
 For Each s In ActiveDocument.Shapes
        MsgBox s.Name
    Next s

This returns the name of the text box

then:
Code:
    ActiveDocument.Shapes("Text Box 4").Select
    Selection.TypeText Text:="xxxx"
puts the text in
 
Depends on what type of "textbox" - I hate that phrase. Sigh.

If it is a FormFields textbox, then text in the box is the .Result property of the FormField, as in:

ActiveDocument.FormFields("formfieldName").Result

Is it an ActiveX textbox? If so, then text in the box is the .Text property of the Range, as in:

ActiveDocument.InlineShapes("Textbox1").Range.Text

What do you mean by "populate"?

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top