none
Relationship of .dot to .doc files? RRS feed

  • Question

  • There is a small Word application embedded in my PowerBuilder application. I have never worked with Word programming, although I'm familiar with VBA via MS Access, and once long ago from Excel. My question is, how do the .dot and .DOC files relate to each other? I put a break point at the top of the .dot macro and expected it to execute when I opened the .doc file. Didn't do it. In Excel and Access, the VBA is accessed via the end product, a letter or a spreadsheet. And is executed when those objects are opened. How does it work in Word?

    TIA

    LAS

    Thursday, January 29, 2015 3:02 PM

Answers

  • Hi LAS,

    .dot file is Word2003 template file. Custom word template files are stored in this folder:

    C:\Users\user\Documents\Custom Office Templates

    When you create a new document file based on the macro-enabled Word template, the VBA project in the template file will be opened along with the new document file's VBA project. It looks like the document itself and the template file are opened all together.  But if you want to save the VBA code in the template file along with the document, you need to save the document as Macro-Enabled document(that is .doc file in Word 2003, .docm in later Word versions).

    >>My question is, how do the .dot and .DOC files relate to each other? I put a break point at the top of the .dot macro and expected it to execute when I opened the .doc file.

    It does not mean that the top of the .dot macro will be executed when the .doc file(which is based on the .dot file) is opened. It is the Open event of the Document object will be fired. If the top of the macro is not called by the Document_Open event handler, it'll not be executed.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by LASLASLAS14 Tuesday, February 3, 2015 5:14 PM
    Friday, January 30, 2015 6:37 AM
    Moderator
  • You may also find the following article useful:

    http://word.mvps.org/faqs/macrosvba/documentevents.htm

    Peter Jamieson

    • Marked as answer by LASLASLAS14 Tuesday, February 3, 2015 5:15 PM
    Friday, January 30, 2015 9:25 AM

All replies

  • Hi LAS,

    .dot file is Word2003 template file. Custom word template files are stored in this folder:

    C:\Users\user\Documents\Custom Office Templates

    When you create a new document file based on the macro-enabled Word template, the VBA project in the template file will be opened along with the new document file's VBA project. It looks like the document itself and the template file are opened all together.  But if you want to save the VBA code in the template file along with the document, you need to save the document as Macro-Enabled document(that is .doc file in Word 2003, .docm in later Word versions).

    >>My question is, how do the .dot and .DOC files relate to each other? I put a break point at the top of the .dot macro and expected it to execute when I opened the .doc file.

    It does not mean that the top of the .dot macro will be executed when the .doc file(which is based on the .dot file) is opened. It is the Open event of the Document object will be fired. If the top of the macro is not called by the Document_Open event handler, it'll not be executed.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by LASLASLAS14 Tuesday, February 3, 2015 5:14 PM
    Friday, January 30, 2015 6:37 AM
    Moderator
  • You may also find the following article useful:

    http://word.mvps.org/faqs/macrosvba/documentevents.htm

    Peter Jamieson

    • Marked as answer by LASLASLAS14 Tuesday, February 3, 2015 5:15 PM
    Friday, January 30, 2015 9:25 AM