Results 1 to 5 of 5

Thread: Adding Variables to Templates

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2005
    Location
    SoCal
    Posts
    54

    Adding Variables to Templates

    I want to add variables to a template.
    When I add the variables & run the code, the next time I open the template it seems the variables have been saved to the template instead of needing to be added with each document instance of the template?
    How do I add the variable to the template such that it will not keep trying to readd that variable each time the template is opened? The only thing I've seen thus far is a for loop nested in an if loop that tests each variable to see if its name matches the one in question, but this seems inefficient - especially when I am using many variables.

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Adding Variables to Templates

    are you working in a module under the template, or a module under the document?

    pete
    Attached Images Attached Images  

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2005
    Location
    SoCal
    Posts
    54

    Re: Adding Variables to Templates

    I am working under the template, but I am working in the code part of the UserForm. Should I be writing a macro within the module instead to add the variables, then running it once?

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Adding Variables to Templates

    i am not quite sure i understand but if the variables values are saved, which is strange just set them to "" or appropriate nil value on document open or document new as the case might be

    or possibly when you create the variables, create a boolean to tell you that all the variables are created


    pete

  5. #5

    Thread Starter
    Member
    Join Date
    Mar 2005
    Location
    SoCal
    Posts
    54

    Re: Adding Variables to Templates

    How are docvariables (the ones that integrate with field code under Insert/Field/DocVariable) within the document itself typically created (for templates)? I know the code, but do I put the code to create them in the userform that will assign their values, or in a macro within the modules, or in the initialization code, or where?

    Putting a boolean in that tells me it exists would be great if they had an exists property for the docvariables. As it is, I'm not sure how that would work, except maybe through some error code?

Posting Permissions

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



Click Here to Expand Forum to Full Width