C
call_me_sol
Hi -
I have a simple find/replace textbox that I use to replace specific
bookmarks within a document. Currently, user inputs values into the
text box, hits a button, and the various bookmarks are replaced with
the contents of the text box.
Now, I want to add a CLEAR button to my text box so the user can start
over. Please note that I only want to wipe out the contents of the
text box (not the entire document) so the user has a fresh text box
with which to start.
One problem, though, is that my current code automatically closes the
text box after all of the replacements have taken place. I need the
auto-close feature to stop.
Here is my existing code:
Private Sub CommandButton1_Click()
Dim oRng As Word.Range
Dim oBMs As Bookmarks
Set oBMs = ActiveDocument.Bookmarks
Set oRng = oBMs("RD").Range
oRng.Text = TextBox1
oBMs.Add "RD", oRng
Set oRng = oBMs("DOS").Range
oRng.Text = TextBox3
Set oRng = Nothing
Set oBMs = Nothing
Unload Me
End Sub
Thank you for any help provided!
I have a simple find/replace textbox that I use to replace specific
bookmarks within a document. Currently, user inputs values into the
text box, hits a button, and the various bookmarks are replaced with
the contents of the text box.
Now, I want to add a CLEAR button to my text box so the user can start
over. Please note that I only want to wipe out the contents of the
text box (not the entire document) so the user has a fresh text box
with which to start.
One problem, though, is that my current code automatically closes the
text box after all of the replacements have taken place. I need the
auto-close feature to stop.
Here is my existing code:
Private Sub CommandButton1_Click()
Dim oRng As Word.Range
Dim oBMs As Bookmarks
Set oBMs = ActiveDocument.Bookmarks
Set oRng = oBMs("RD").Range
oRng.Text = TextBox1
oBMs.Add "RD", oRng
Set oRng = oBMs("DOS").Range
oRng.Text = TextBox3
Set oRng = Nothing
Set oBMs = Nothing
Unload Me
End Sub
Thank you for any help provided!