Results 1 to 7 of 7

Thread: VBA to save from template dotm to VBA enabled file docm

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    VBAX Regular
    Joined
    Nov 2018
    Posts
    14
    Location
    Quote Originally Posted by macropod View Post
    Provided the document is saved to a folder from which it can access its template, there is no need to use the docm format; a docx file can just as easily access the template's macros.
    I am not sure how this is possible since my understanding that once I save the file as docx, I will lose all macros stored before with the template. The idea behind me saving the file as docm is the following, user will use 2 macros as following:
    First: When fill report header (customer name, date and contract number), he should run first macro (the one I am requesting here) in order for MS Word to save the report and name it as combination of previous 3 fields.

    Second: Later and when user finalizes his work on the report, he should run another macro which will hide all hidden text.

    Now, when user opens template and run first macro, file should be saved as docm so he can later run the second code within same file generated from my original template.


    Quote Originally Posted by macropod View Post
    Moreover, it's not apparent from your code whether it is the template or a document created from it whose content controls have been updated; the error suggests it's the latter whereas you're querying the former.
    I didn't get your point. I have attached sample file which the fields used in my code. File name is reading fields with no error (or this is what I see in the Locals window when testing the code manually through F8).
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •