arcanedevice
09-01-2008, 10:17 PM
Hi
I've created a UserForm that will assist the User to populate a set of fields within a Template each time it is opened. All the code works except for the cmdOkay_Click(), which returns an run-time error of 6028, 'The range cannot be deleted'. I'm not sure where I'm going wrong and looking for any help...
Private Sub cmdOkay_Click()
Application.ScreenUpdating = False
With ActiveDocument
.Bookmarks("LetterDate").Range.Text = LetterDateText.Value
.Bookmarks("ActivityItem").Range.Text = ActivityItemText.Value
.Bookmarks("Addressee").Range.Text = AddresseeText.Value
.Bookmarks("AddLine1").Range.Text = AddLine1Text.Value
.Bookmarks("AddLine2").Range.Text = AddLine2Text.Value
.Bookmarks("AddLine3").Range.Text = AddLine3Text.Value
.Bookmarks("TitleSurname").Range.Text = TitleSurnameText.Value
.Bookmarks("ComplaintDate").Range.Text = ComplaintDateText.Value
.Bookmarks("EntityIssue").Range.Text = EntityIssueText.Value
.Bookmarks("TeamLeader").Range.Text = TeamLeaderText.Value
End With
Application.ScreenUpdating = True
Unload Me
End Sub
I've created a UserForm that will assist the User to populate a set of fields within a Template each time it is opened. All the code works except for the cmdOkay_Click(), which returns an run-time error of 6028, 'The range cannot be deleted'. I'm not sure where I'm going wrong and looking for any help...
Private Sub cmdOkay_Click()
Application.ScreenUpdating = False
With ActiveDocument
.Bookmarks("LetterDate").Range.Text = LetterDateText.Value
.Bookmarks("ActivityItem").Range.Text = ActivityItemText.Value
.Bookmarks("Addressee").Range.Text = AddresseeText.Value
.Bookmarks("AddLine1").Range.Text = AddLine1Text.Value
.Bookmarks("AddLine2").Range.Text = AddLine2Text.Value
.Bookmarks("AddLine3").Range.Text = AddLine3Text.Value
.Bookmarks("TitleSurname").Range.Text = TitleSurnameText.Value
.Bookmarks("ComplaintDate").Range.Text = ComplaintDateText.Value
.Bookmarks("EntityIssue").Range.Text = EntityIssueText.Value
.Bookmarks("TeamLeader").Range.Text = TeamLeaderText.Value
End With
Application.ScreenUpdating = True
Unload Me
End Sub