Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-12-2015, 07:45 AM
badbane badbane is offline Can't put values into prebuilt textbox Windows 7 64bit Can't put values into prebuilt textbox Office 2010 64bit
Novice
Can't put values into prebuilt textbox
 
Join Date: Jan 2015
Posts: 1
badbane is on a distinguished road
Default 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 .
Reply With Quote
  #2  
Old 01-12-2015, 01:05 PM
macropod's Avatar
macropod macropod is offline Can't put values into prebuilt textbox Windows 7 64bit Can't put values into prebuilt textbox Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #3  
Old 01-12-2015, 03:50 PM
jjfreedman jjfreedman is offline Can't put values into prebuilt textbox Windows 7 64bit Can't put values into prebuilt textbox Office 2013
Advanced Beginner
 
Join Date: May 2012
Location: https://jay-freedman.info
Posts: 39
jjfreedman is on a distinguished road
Default

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.
Reply With Quote
Reply



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
Can't put values into prebuilt textbox TextBox / Shape name OlivierS PowerPoint 1 10-25-2014 07:57 PM
Can't put values into prebuilt textbox Find textbox name Hdata Word VBA 17 02-01-2014 06:50 AM
Can't put values into prebuilt textbox 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

Other Forums: Access Forums

All times are GMT -7. The time now is 03:59 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft