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

Working with Header/Footer

Status
Not open for further replies.

djsslp

Technical User
Jul 5, 2001
5
US
Here again!

I have an empty label placed in a Header. A user form with text boxes comes up when the doc is opened and the user has the opportunity to input some text into the boxes. Once this user input the info--can click a button and pass that info into the .Caption property of the label of the Header.

Great! But I don't know how to get the text from the text box into the label in the Header! Can anyone help?

Thanks in advance...

adios...
 
Thanks JoaoTL, but what is
Code:
Me.
? Is this supposed to be an object?

Here's what I have...

1. On a document, I have a label named lblStudentName that is located in the Header portion of the document
2. I also have a pop-up form called frmStudentInfo
3. This userform has text boxes on it where someone can type in info - one of the text boxes is called txtStudentName
4. The user can type in the student name and click a button. At this event I am trying to get the info from the userform into the Caption property of the label that's in the Header of ThisDocument.
5. In the button click event I have this so far...remember, the textbox and button are on a userform and the label is on the document itself....
***********************************
Code:
Dim sStudent As String

sStudent = txtStudentName.Text

lblStudentName.Caption = sStudent
***********************************
This sends an error saying that I need an object What object do I need?

I am almost done with this project except for this!!! Please help!! X-)

adios....
 
The 'object' is the document with the caption

This could be the ActiveDocument if the document with the label is active

or ThisDocument if the code is in macros/forms of the document with the label

 
I appreciate the help but nothing is working so far!

The problem seems to be that I can't pass the text from a textbox off a user form into the caption property of a label on a document. The label is in the Header of the document.

Does the label being in the Header portion of the document have anything to do with it? I believe it does b/c I can pass text from a textbox on a user form into any part of the document except the Header.

I tried this:

Code:
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.HeaderFooter.Range.Text = ?????
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument

The problem I have here is where can I put this???:

Code:
lblLabel.Caption = txtText.Text

The error I am getting says I need an OBJECT, but which object...a Header object? If so how do I write code for a Header object?

Again, I created a document....in the Header portion of the document I placed a label...I then created a userform....the userform has a textbox and a button....the user is supposed to get the text in the textbox into the label caption of the label that is in the Header portion of the document...the user can then close out the userform and return to the document and see the label (in the Headerportion) filled with the text he just put in!

PLEASE HELP!

adios...



 
Try
ThisDocument.lblLabel.Caption = txtText.Text
or
ActiveDocument.lblLabel.Caption = txtText.Text

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top