I have created a form in VB for word that allows you to enter details into a form and then they are placed on a letter template in word where I have placed bookmarks.
I then want the bookmarks to be deleted so I can use the form again. Can someone tell me how to delete the text created at the bookmarks. Or to reset the letter to clear everything entered.
I'm using the code:
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
With ActiveDocument
.Bookmarks("title").Range.Text = title.Value
.Bookmarks("Address").Range.Text = Address.Value
.Bookmarks("NINO").Range.Text = NINO.Value
.Bookmarks("NINO2").Range.Text = NINO.Value
.Bookmarks("EndDate").Range.Text = chbenddate.Value
.Bookmarks("Processor").Range.Text = Processor.Value
.Bookmarks("fullname").Range.Text = fullname.Value
.Bookmarks("fullname2").Range.Text = fullname.Value
End With
Application.ScreenUpdating = False
Unload Me
ActiveDocument.PrintOut Background:=False
chblettergen.Show
End Sub
I have used this as on another thread to try and clear the fields. But it doenst work
With ActiveDocument
.Bookmarks("title").Range.Text = ""
.Bookmarks("Address").Range.Text = ""
.Bookmarks("NINO").Range.Text = ""
.Bookmarks("NINO2").Range.Text = ""
.Bookmarks("Processor").Range.Text = ""
.Bookmarks("EndDate").Range.Text = ""
.Bookmarks("fullname").Range.Text = ""
.Bookmarks("fullname2").Range.Text = ""
End With
Any help anyone can offer me will be greatly appreciated. Or if there is another way around this.