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

Open word et access to textbox within the active document in VBA

Status
Not open for further replies.

MrBaRRon

Programmer
Aug 8, 2003
39
IT
Hi everybody,

I would like to open Word and I want to set the value of the textbox within the document, in VBA of course.

What is the way ?

Thank U
 
You have to tell us what kind of "textbox". Lordy, I dislike that word.

Is it an ActiveX Control textbox?
Is it a text Form Field?

They have different methods to get values in them.

Gerry
 
Hi fumei,

Before I could set its value with this code:

Dim wrd As Word.Application

Set wrd = CreateObject("Word.Application")
wrd.Visible = True
wrd.Documents.Open "C:\ECORIGEN\Report_Totsucat.doc"

wrd.ActiveDocument.client = "TONTON"

This textbox "client" is in the header of my document, so in each page their is the same form control with the same name. With this syntax it worked and the control in each header of each page had the same value (that I want).

But I have created sections in the document to be able to copy the content of a page and to paste it at the good place.

And since I created sections I can't set the value of the textbox with the syntax above...
It tell me that the property or the method is not managed by this object....

Any idea ?

Thank U
 
And I created this textbox with the Word bar tools of forms.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top