none
Create custom template RRS feed

  • Question

  • Hello guys, what is the ideal programming language or tool to create a custom template in word that can be deployed to users?

    Can it be done via Macro, C#, Vb.Net or is there a specific tool to do this?

    Thank you.


    Every second counts..make use of it. Disclaimer: This posting is provided AS IS with no warranties or guarantees and confers no rights.

    Friday, February 2, 2018 3:03 AM

Answers

  • You wouldn't create a template with code. Template creation is a once-off exercise. Writing the code to create a template would take far longer than creating one manually. Having created the template, you'd then distribute it to the appropriate workgroups (a task a Sys Admin could do).

    Cheers
    Paul Edstein
    [MS MVP - Word]

    • Marked as answer by cguan Wednesday, February 7, 2018 8:47 AM
    Friday, February 2, 2018 5:50 AM
  • Hello cguan,

    You could specific true for NewTemplate while using Add method  so it will create a template document.

    You could also specific fileformat while using SaveAs2 method to save the file as a template document.

    Here is a simply example in C#,

           //add reference to Microsoft.Office.Interop.Word
                //using Word = Microsoft.Office.Interop.Word
                //wdApp is word application instance
                Word.Document newDoc = wdApp.Documents.Add(NewTemplate: true);
                string SaveName = @"C:\Users\Admin\Desktop\TestTemp.dotm";
                newDoc.SaveAs2(SaveName, Word.WdSaveFormat.wdFormatXMLTemplateMacroEnabled);

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by cguan Wednesday, February 7, 2018 8:47 AM
    Monday, February 5, 2018 3:26 AM

All replies

  • You wouldn't create a template with code. Template creation is a once-off exercise. Writing the code to create a template would take far longer than creating one manually. Having created the template, you'd then distribute it to the appropriate workgroups (a task a Sys Admin could do).

    Cheers
    Paul Edstein
    [MS MVP - Word]

    • Marked as answer by cguan Wednesday, February 7, 2018 8:47 AM
    Friday, February 2, 2018 5:50 AM
  • Hello cguan,

    You could specific true for NewTemplate while using Add method  so it will create a template document.

    You could also specific fileformat while using SaveAs2 method to save the file as a template document.

    Here is a simply example in C#,

           //add reference to Microsoft.Office.Interop.Word
                //using Word = Microsoft.Office.Interop.Word
                //wdApp is word application instance
                Word.Document newDoc = wdApp.Documents.Add(NewTemplate: true);
                string SaveName = @"C:\Users\Admin\Desktop\TestTemp.dotm";
                newDoc.SaveAs2(SaveName, Word.WdSaveFormat.wdFormatXMLTemplateMacroEnabled);

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by cguan Wednesday, February 7, 2018 8:47 AM
    Monday, February 5, 2018 3:26 AM