Selecting the right document

  • Thread starter Thread starter polska2180
  • Start date Start date
P

polska2180

Private Sub CommandButton1_Click()
ActiveDocument.Unprotect
WordBasic.MailMergeFindEntry
Application.ScreenUpdating = False
Windows("SERVICE AGREEMENT (Read-Only)").Activate
Selection.WholeStory
Selection.Copy
Documents.Add DocumentType:=wdNewBlankDocument
Selection.PasteAndFormat (wdPasteDefault)
Selection.TypeBackspace
ActiveDocument.Protect Password:="", NoReset:=False, Type:= _
wdAllowOnlyFormFields
Windows("SERVICE AGREEMENT (Read-Only)").Activate
ActiveDocument.Protect Password:="", NoReset:=False, Type:= _
wdAllowOnlyFormFields
End Sub


Okay, here is my script. As you can see after a new document i
created the origingal merged document (read-only) is selected t
protect it. Now my problem is that although i want "Servic
Agreements" protected I want the new document to be showing. Wha
would be the script that would allow me to leave the new documen
active but still protect 'service agreement'

NOTE: Making the new document active after the at the end would no
work as there can be several new documents created ie 'document 1'
'document 2' etc. I want the most recent document to be active.
Thanks
 
Is there a reason you aren't using a template? By default you can
create a document based on the template and there is no need to
copy/paste the text in a new document, which btw there are better VBA
methods to use for this such as Documents.Add method.

--
Please post all follow-up questions to the newsgroup. Requests for
assistance by email can not be acknowledged.

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP

Word FAQ: http://mvps.org/word
TechTrax eZine: http://mousetrax.com/techtrax/
MVP FAQ site: http://mvps.org/
 
Back
Top