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

Insert Text in Word

Status
Not open for further replies.

nigz

Programmer
Jun 15, 2001
60
GB
I have built a form with textboxes & when I press the finish button it inserts the text into a document. However I want the text to overwrite rather than insert.I've used the following code:

Selection.GoTo wdgotobookmark, Name:="B1"
Overwrite = true
Selection.TypeText Textbox1.Text

The reason I want to overwrite is that the forms have lines (made up of underscores) where I insert the text & I want to overwrite thise lines with the inserted text.
 
niqz,

Try the following:

Code:
Application.Options.ReplaceSelection = True
Selection.GoTo wdgotobookmark, Name:="B1"
Selection.TypeText Textbox1.Text

Regards,
M. Smith
 
Thanks - but have found another way of tackling the problem now.
 

i would do it like this

dim a

set a = ActiveDocument.Bookmarks("B1")
a.range.text="This is the text"

Greatings
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top