Hi all,
Forgive my semi-newbieness. I'm trying! I've come a long way, thanks in large part to you all and vbforums.com. I'm nearing in on the last leg of a major endeavour and have hit a little snag that maybe (hopefully) somebody can help out with. Thanks for taking the time to read me wall o' text below.
I've set up several hundred field codes, taking inputs from Excel and bringing them into a 100-page Word document. MANY of the field codes are redundant, and cause a lot of overhead - things such as "I" versus "We", "I was" versus "We were", etc. Approximately half of what's coming in to Word is duplicated, and an update of all fields takes 3-5 minutes.
I've tried creating a bookmark to the first instance of a redundant field, and just used an OLE link to reproduce the same field throughout Word. That works fine ... until I rename Word and Excel [e.g., when I start anew with another project]. In that instance, my Excel->Word field codes get renamed with the new path and new file name; however, Word's OLE links do not change. They stay static to the original file name - and I've not been able to make them programatically change (yet).
Let me preface this all by saying that I've got a macro that I fire from a Template.xls file. The macro looks in the template for the name of a document template in my template directory [i.e., BANK.dot, CHURCH.dot, etc.], opens the right template, then prompts me for a save location. The macro then saves the new Excel file, then it replaces the full path to Template.xls with the full path to the new Excel file ["sSaveName".xls]. The macro concludes with saving the updated Word document as sSaveName.doc. [Code available if needed]
So, my thought is this: Do an If/then from within my macro, appearing after the save of my sSaveName.xls file [so that the new full path is established] to look at Cell "A1" for the appropriate format of the field that is redundant [that is, assume A1 = "I" versus "We"]. The macro should capture this field and store it as a variable. The macro should then go into Word and do a find/replace for some "placeholder" like __I_or_We__ and replace all instances of the placeholder with the appropriate field.
Can anybody help with this?
Thanks in advance.
Hoop