Results 1 to 9 of 9

Inserting word custum template at end of document on new page

Threaded View

  1. #1
    Registered User
    Join Date
    01-09-2013
    Location
    Helsingborg, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    47

    Inserting word custum template at end of document on new page

    Hello!

    I could really use help with macro for inserting template.
    I have a Main word macro file, with 2 front pages and a third page as a template. The document is password protected so the end user can only fill in the yellow marked areas, when they have filled in the 2 front pages and the third template page, and need to insert another 4 page exactly as page no 3. they press short command "Alt + N" as in new page.

    the macro then should insert the new page from the template word file. and put it last, first unlocking the word file, then inserting, then putting the password back on.

    This works fine as long as you are only active with the cursor in the yellow marked areas or at the end of the document. but when you for example ar in the header, or footer. the macro fails and stops when the word file is unprotected. wich is not good.

    Could anyone help me?

    I need it to always abort the current command, jump to last page in document, then unprotect the document, insert the template, and protect the document again. enabling the user to continuing adding information.

    Pardon my english.

    The code i use now is as follows.

    Sub NCCMallSimpel()
    '
    ' NCCMallSimpel Makro
    ' Make new page
    '
        
        ActiveDocument.Unprotect Password:="1111"
        Selection.EndKey Unit:=wdStory
        Selection.InsertBreak Type:=wdPageBreak
        Dim myDocPath As Selection
        Selection.InsertFile FileName:="Tabellmall Standard.docm", Range:="", ConfirmConversions:=False, Link:=False, Attachment:=False
        Selection.EndKey Unit:=wdStory
        Selection.TypeBackspace
        Selection.EndKey Unit:=wdStory
        ActiveDocument.Protect Password:="1111", NoReset:=False, Type:= _
            wdAllowOnlyComments, UseIRM:=False, EnforceStyleLock:=False
    End Sub
    Thanks in advance for any help!
    Last edited by lavinius; 05-20-2013 at 06:43 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1