none
How to create an automatic master template based on subdocuments with overlaping texts? RRS feed

  • Question

  • Goodmorning,

    I am trying to find out how to create a word template from separate subdocuments, automatically.

    There are three stages to fill in to get an approval. The first stage contains three text boxes. However, in the second stage additional information need to be given, but the same three boxes of the first stage need to be included in the document as well.

    To avoid `copy and paste` activities I am trying to create a template.

     

    However, when I create subdocuments and I re-open the master document I only get the links towards the location of the subdocuments.

    In addition, I would like to link the information in the subdocuments to one masterdocument but only the information which is relevant for that stage. For example: document 1 for stage 1 needs to be visible but document 2 for stage 2 and document 3 for stage 3 should not be visible if they are not filled in with text.

     

    Another option could be is to create (I have no clue if this is possible) a dropdown list with choices where you can click on the desired document and then the necessary field appear. However, with this option it might be difficult to get the data of the first document automatically copied in the second selected document and so forth.

     Another option could be to check a checkerbox for document 1 and if an approval is given, the user can check the checkerbox for the second document and the additional text blocks appear in the word document. 

    Hope above provides a good explanation and there is a solution within word J.

    Tuesday, November 22, 2016 8:07 AM

All replies

  • Hi K1990,

    you had mentioned that ," how to create a word template from separate subdocuments, automatically. "

    use the code mentioned below to crate template.

    Documents.Add Template:="C:\Program Files\Microsoft Office" _ 
     & "\Templates\Memos\Professional Memo.dot"
    


    create and open a new template, using the template attached to the active document as a model.

    tmpName = ActiveDocument.AttachedTemplate.FullName 
    Documents.Add Template:=tmpName, NewTemplate:=True
    

    then you had mentioned that,"There are three stages to fill in to get an approval"

    who will give this approval?

    then you had mentioned that,"The first stage contains three text boxes. However, in the second stage additional information need to be given, but the same three boxes of the first stage need to be included in the document as well."

    use the code mentioned below to add textbox in document.

     Set shpCanvas = docNew.Shapes.AddCanvas _ 
     (Left:=100, Top:=75, Width:=150, Height:=200) 
     
     'Add a text box to the drawing canvas 
     shpCanvas.CanvasItems.AddTextbox _ 
     Orientation:=msoTextOrientationHorizontal, _ 
     Left:=1, Top:=1, Width:=100, Height:=100 
    

    then you had mentioned that,"document 1 for stage 1 needs to be visible but document 2 for stage 2 and document 3 for stage 3 should not be visible if they are not filled in with text."

    use the code mentioned below to add text from other document.

    ThisDocument.Range.InsertAfter("String") 'Insert text
    
    Selection.WholeStory 'Select whole document
    Selection.Expand wdParagraph 'Expands your selection to current paragraph
    Selection.Copy 'Copy your selection
    Documents("name.doc").Activate 'Activate the other document
    Selection.EndKey wdStory 'Move to end of document
    Selection.PasteAndFormat wdPasteDefault 'Pastes in the content

    Here I think that you need to develop a userform.

    place all the controls on userform as option to add contents in your template.

    something like mentioned below.

    Regards

    Deepak

    Wednesday, November 23, 2016 4:53 AM
    Moderator
  • Your post suggests you're trying to use Word's broken 'master document' feature. Only do that if you need the character-building therapy that trying to recover terminally-destroyed documents will give you! Seriously. See:

    http://word.mvps.org/FAQs/General/WhyMasterDocsCorrupt.htm
    http://www.word.mvps.org/FAQs/AppErrors/CorruptDoc.htm
    http://www.addbalance.com/word/masterdocuments.htm


    Cheers
    Paul Edstein
    [MS MVP - Word]

    Wednesday, November 23, 2016 6:31 AM