Forum Discussion

perkin_warbeck's avatar
perkin_warbeck
Brass Contributor
Oct 11, 2020
Solved

Separating program from data in a VBA application

I'm new to VBA, but I come from a software development background.  I have written an Excel application entirely in VBA (there are no formulas in worksheets).  I am constantly enhancing the code, and...
  • HansVogelaar's avatar
    HansVogelaar
    Oct 11, 2020

    perkin_warbeck 

    In Microsoft Word, you can store VBA code intended for a single document in that document.

     

    If you want code to be available to a class of documents, you store the code in a template (.dotm) and create documents from that template (or if the document already exists, attach - i.e. connect - the template to the document). You can update the template and the updated code will be available to all documents associated with the template. The code will not be stored in the associated documents themselves.

     

    If you want code to be available to all documents, you can store it in a global template aka add-in. By default, each Word user has a macro template Normal.dotm, but you can create others. When you update the template, the modified code will be available to all documents.

Resources