not sure if this went up the first time!
Can anyone help?
I have a form which i use to enter information into the
header of a document, when the ok button is clicked i
have to following code:
Private Sub OK_Click()
With ActiveDocument
.Bookmarks("est").Range _
.InsertBefore TextBox1
End With
UserForm1.Hide
End Sub
the only trouble is if i need to modify a field, i.e i
reopen the form and re enter the data it will only add to
what is already there, for example if i enter 'xxx' in
the first instance and need to change it to 'yyy' it will
be displayed in my header as xxxyyy i need some sort of
code to erase what is already there and re enter the text
when the form is reused.
please forgive me if the answer to this question is a
bit, well, obvious but i am very new to this whole thing!
your help would be massively appreciated!
Regards
Alex
Word Heretic - 22 Dec 2004 23:43 GMT
G'day "alex" <althekid99@hotmail.com>,
Change InsertBefore to Text
You may have to re-establish the bookmark onto that range, so use a
range object for this work
Public Sub OK()
Dim myRange As Range
Set myRange = ActiveDocument.Bookmarks("est").Range
myRange.Text = "Whatever"
ActiveDocument.Bookmarks.Add "est", myRange
Set myRange = Nothing
End Sub
Steve Hudson - Word Heretic
steve from wordheretic.com (Email replies require payment)
Without prejudice
alex reckoned:
>not sure if this went up the first time!
>
[quoted text clipped - 31 lines]
>
>Alex