#1
|
|||
|
|||
Can't put values into prebuilt textbox
I have a document that has a cover page with several text boxes. I just want to type in the company name in the text box name title on the cover page and then update the heading to include the title of the document. Problem is when I try to simply test the name of the textbox on the cover I can't change the text in it. The title of the text box is "Title" and on change I want to simply copy the text in "title.textframe.textrange.text" when the value in the title texbox changes and put it in Header.textframe.textrange.text. But I can't even read a value into title.textframe.textrange.text . |
#2
|
||||
|
||||
If 'title' is the name of your textbox (not merely some text in it), should be using code like:
ActiveDocument.Shapes("title").TextFrame.TextRange .Text = "Some Text" As for replicating the content in the page header, headers don't have textframe.textrange properties; they have a range property, just like the body of the document - but you also have to specify which header to work with. In any event, you don't need a macro for that, all you need do is assign a unique Style name to your 'title' textbox and use a STYELREF field in the header to reference that Style.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
If you're using one of the cover pages from Insert > Cover Page, then the "text box" isn't a text box or a Shape. It's a content control containing the built-in document property named Title. That document property is mapped to XML in the document file.
You can repeat the content anywhere else in the document, including in a header, by placing the cursor at the desired location and clicking Insert > Quick Parts > Document Property > Title. The same is true of any of the other document properties in that list. If you edit the content of one Title content control. the change will automatically appear in all other Title content controls anywhere else in the document. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Concatenate two textbox values for message box | Smithy02468 | Excel Programming | 1 | 11-08-2014 10:48 PM |
TextBox / Shape name | OlivierS | PowerPoint | 1 | 10-25-2014 07:57 PM |
Find textbox name | Hdata | Word VBA | 17 | 02-01-2014 06:50 AM |
Display result in textbox based on the input of another textbox | scarymovie | Word VBA | 5 | 05-16-2012 07:05 PM |
Textbox Template | t0m46 | Word | 0 | 09-07-2010 03:38 AM |