G
Gordon Bentley-Mix
I'm sure this can be done, but I've not done it before and would appreciate a little direction before I dive in.
I have a process that requires multiple documents to be created based on certain criteria. I envision using a 'main' template - let's call it "the DC" (for Data Collection) - to collect this criteria and the additional information to be used in the creation of the additional documents. Each of the additional documents will be based on a specific template - let's call it "the AD" (for Additional Document - actually one of two templates, but the basic function of these templates is the same), and I need the information collected in the DC to be available to the AD. The DC will collect the criteria/information in an array, and the data in the array will be used for two purposes: first, it will be evaluated to determine how many additional documents need to be created (and which template to use for each); and second, parsed data from the array in the form of two strings will be used by the AD to generate the document. The number of additional documents may vary, but at least one additional document will be created each time the process in the DC is run.
I have a pretty good grip on how to collect the data, how to evaluate it to determine how many of which type of additional document needs to be created, how to create the additional documents, how to parse the data to use in the additional documents, and how to use this data. For example, I know that calling Documents.Add and specifying a particular template will create the additional document, and I know that if the AD contains an AutoNew macro, the code will run automatically. I also know how the AutoNew code should work to make use of the data from the DC.
However, the part I'm not sure about is how to actually pass the data from the DC to the AD code. I haven't tested anything, but my intuition tells me that simply declaring a couple of Public String variables won't do the trick; these variables will only be available to the code in which they are declared and not to the code in another template. I suspect that something like an .ini file or the registry or a global constant might be required, but I've not worked with any of these before. Does anyone have any suggestions on the best approach? And would you happen to know of a resource I can look to for some direction on how to implement it?
--
Cheers!
Gordon Bentley-Mix
Word MVP
Please post all follow-ups to the newsgroup.
Read the original version of this post in the Office Discussion Groups - no membership required!
I have a process that requires multiple documents to be created based on certain criteria. I envision using a 'main' template - let's call it "the DC" (for Data Collection) - to collect this criteria and the additional information to be used in the creation of the additional documents. Each of the additional documents will be based on a specific template - let's call it "the AD" (for Additional Document - actually one of two templates, but the basic function of these templates is the same), and I need the information collected in the DC to be available to the AD. The DC will collect the criteria/information in an array, and the data in the array will be used for two purposes: first, it will be evaluated to determine how many additional documents need to be created (and which template to use for each); and second, parsed data from the array in the form of two strings will be used by the AD to generate the document. The number of additional documents may vary, but at least one additional document will be created each time the process in the DC is run.
I have a pretty good grip on how to collect the data, how to evaluate it to determine how many of which type of additional document needs to be created, how to create the additional documents, how to parse the data to use in the additional documents, and how to use this data. For example, I know that calling Documents.Add and specifying a particular template will create the additional document, and I know that if the AD contains an AutoNew macro, the code will run automatically. I also know how the AutoNew code should work to make use of the data from the DC.
However, the part I'm not sure about is how to actually pass the data from the DC to the AD code. I haven't tested anything, but my intuition tells me that simply declaring a couple of Public String variables won't do the trick; these variables will only be available to the code in which they are declared and not to the code in another template. I suspect that something like an .ini file or the registry or a global constant might be required, but I've not worked with any of these before. Does anyone have any suggestions on the best approach? And would you happen to know of a resource I can look to for some direction on how to implement it?
--
Cheers!
Gordon Bentley-Mix
Word MVP
Please post all follow-ups to the newsgroup.
Read the original version of this post in the Office Discussion Groups - no membership required!