J
Julie
Hi - I have a template called Letterhead. It contains a
user form and some simple code. When I choose File, New
and select "Letterhead" it appears with the user form and
works as expected. When I choose File, New again, and
select the same template, it creates a new document in the
background, but adds the text I enter into the user form,
in the current, on-screen letter. So it does create the
new document, but adds the text to the bookmarks in the
current document. Strange! My other templates do not
have this problem. Help! Here's the code:
Private Sub Document_New()
With frmLetterhead
.txtName = ""
.txtDD = ""
.txtIntAdd = ""
.txtName.SetFocus
End With
frmLetterhead.Show
If btnOKClicked = True Then
ActiveDocument.Bookmarks("bkName").Range.Text =
frmLetterhead.txtName
ActiveDocument.Bookmarks("bkDD").Range.Text =
frmLetterhead.txtDD
ActiveDocument.Bookmarks("bkIntAdd").Range.Text =
frmLetterhead.txtIntAdd
Else
ActiveDocument.Close wdDoNotSaveChanges
End If
Selection.EndKey Unit:=wdStory
End Sub
Thanks for your help.
user form and some simple code. When I choose File, New
and select "Letterhead" it appears with the user form and
works as expected. When I choose File, New again, and
select the same template, it creates a new document in the
background, but adds the text I enter into the user form,
in the current, on-screen letter. So it does create the
new document, but adds the text to the bookmarks in the
current document. Strange! My other templates do not
have this problem. Help! Here's the code:
Private Sub Document_New()
With frmLetterhead
.txtName = ""
.txtDD = ""
.txtIntAdd = ""
.txtName.SetFocus
End With
frmLetterhead.Show
If btnOKClicked = True Then
ActiveDocument.Bookmarks("bkName").Range.Text =
frmLetterhead.txtName
ActiveDocument.Bookmarks("bkDD").Range.Text =
frmLetterhead.txtDD
ActiveDocument.Bookmarks("bkIntAdd").Range.Text =
frmLetterhead.txtIntAdd
Else
ActiveDocument.Close wdDoNotSaveChanges
End If
Selection.EndKey Unit:=wdStory
End Sub
Thanks for your help.