
Word Bookmarks, Userforms and Updates
Hi Jason,
Quote:
> 1. When I return the text contained in a bookmark I get the CR character
at
> the end or sometimes a sqaure box (i.e non characters). how do i stop/fix
> this ?
This can happen if there are paragraph marks in the text in the bookmark. If
you use Word 2000 use the Replace function to replace chr(13) with Chr(10),
which is a new line character
Quote:
> - after the fields are populated from the user form, I need to run a
fields
> update to update REF fields which relate to the Form Fields. but this
makes
> all the form fields blank (the user form is still open). Any idease
reasons
> or improvement suggestions.
That's because your document is not protected. To reprotect use:
activedocument.Protect type:=wdAllowOnlyFormFields,noreset:=true
Or, forget the protection and unlink the fields once you're done and before
you recalculate all the fields:
----------------------------------------------
Sub UnlinkFormfields()
Dim oField As Field
For Each oField In ActiveDocument.Fields
If oField.Type = wdFieldFormTextInput Then
oField.Unlink
End If
Next
Set oField = Nothing
End Sub
After running this code, recalculate all the other fields in the document:
ActiveDocument.Fields.Update
----------------------------------------------
With you unlink a formfield, the field itself will be gone but the result
will be bookmarked so your ref fields will still be working
Quote:
> - when I return the field text to the user form it contains the FORMTEXT
> before the actual text - can this be fixed.
Is the document protected? Or this could have something to do with the way
you put the text into the fields. If the latter, could you show us the code
you're using?
Hope this helps,
regards,
Astrid
So that all can benefit from the discussion,
please post all followups to the newsgroup.
Visit the MVP Word FAQ site at http://www.mvps.org/word/
For direct access to all Microsoft newsgroups: