Building block does not work if someone changes the location template

73 views Asked by At

In vba word. I have a .dotm template file with content blocks. The path in the content blocks works if the .dotm file is in that path.

Application.Templates( _
        "**L:\06. MODELOS DE DOCUMENTOS\01 ATESTADOS\ACCIDENTES DE CIRCULACIÓN\BAEI\Informe Tecnico\BAEI - INFORME TÉCNICO.dotm**"). _
        BuildingBlockEntries("INICIO Y EXPOSICION DE HECHOS").Insert Where:=Selection.Range, RichText _
        :=True

If someone takes the .dotm template file to another path, the content blocks no longer work.

Is it possible to create a macro that asks the user where to save the .dotm template file and substitutes the new path in the code?

1

There are 1 answers

0
Charles Kenyon On

Put the building block and the macro in the same template.

Then you can use ThisDocument.Fullname as the location in your code for the building block. This and other possibilities are explored in my page on building blocks.

This question is cross-posted. Much more extensive exploration of the possibilities and problems in the other forum. Please see A message to forum cross-posters.