![]() |
|
|
|
#1
|
|||
|
|||
|
You can set text in content controls with a userform just as easily as you can bookmarks or anything else.
However if you want to keep patching up an old unruly document that is your business. Say you have three ask fields bookmarkd name, age and IQ. Create a userform with three text fields txtName, txtAge and txtIQ and a command button. Use this as the cb click procedure: Code:
Private Sub CommandButton1_Click()
Dim oRng As Range
Dim oBM As Bookmark
With ActiveDocument
Set oBM = .Bookmarks("Name")
Set oRng = oBM.Range
oBM.Range.Text = txtName
.Bookmarks.Add "Name", oRng
Set oBM = .Bookmarks("Age")
Set oRng = oBM.Range
oBM.Range.Text = txtAge
.Bookmarks.Add "Age", oRng
Set oBM = .Bookmarks("IQ")
Set oRng = oBM.Range
oBM.Range.Text = txtIQ
.Bookmarks.Add "IQ", oRng
End With
Hide
End Sub
|
|
#2
|
|||
|
|||
|
Thanks, Greg. I really appreciate the Code to get a quick fix in place while we decide on whether I will be "unleashed" to do a more comprehensive overhaul. I used your site to get the userform set up, so thanks for all of that great information, as well.
|
|
| Tags |
| bookmark, if fields, userform |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Bookmark not replaced when inserting but to lower right corner of image
|
newbieX | Word VBA | 6 | 11-20-2015 02:03 PM |
| Send Userform Text to Bookmark | tddfs | Word VBA | 5 | 07-30-2015 05:55 PM |
Moving Selected Items from a Multiselect Listbox on a userform to a bookmark in Word
|
marksm33 | Word VBA | 3 | 01-15-2015 07:55 PM |
Word 2003 - IncludeText Does Not Include Bookmark Text if in a Form Text Control
|
skarden | Word | 1 | 12-12-2011 10:39 PM |
delete all bookmark text
|
hklein | Word VBA | 4 | 08-10-2011 04:33 AM |