Hi folks -
This is my first post, though I've gained some valuable info here in the past using the Search facility.
I am having a problem with a Word-based mail merge in a C# Windows form application. The problem has to do with the Normal.dot template.
At a high level, my app copies a Word dot template file (not named
But, I need to keep the newly-created merged content doc file open. Right now, here’s what happens:
The merge takes place, my app ends, and you are left viewing the new doc file in Word.
At this point, you can either “Save As” with this new doc then exit Word, or just exit Word without saving the new doc – the following occurs either way.
A message box appears: “The file is in use by another application or user. (C:\Documents and Settings\...\Normal.dot)”.
Click OK (the only choice) and a “Save As” pane appears referring to Normal.dot.
Click on “Cancel” (because I don’t want to save Normal.dot) and you’re looking at a empty instance of Word.
Click the red X or choose File/Exit and a message box appears: “Changes have been made that affect the global template, Normal.dot. Do you want to save these changes?”
Select “No” and Word finally closes.
Again, if I just wanted to have the app save my new doc then shut down Word this would be easy. But how can I kill whatever has attached itself to Normal.dot while leaving my new doc open in Word? I don’t want the users to have to deal with making choices about the Normal.dot file. Again, the dot I use in the merge is not Normal.dot…
Thanks for any insight about this problem…
Frank
FrankPosted Feb 4, 2009, 4:56 PM
Well, I'm pleased to say that making one last Google search I finally found the answer to this problem. Here it is in case it can help anyone else out. The answer was found here:
*****
http://support.microsoft.com/kb/285885
Before you quit Word or transfer control to the user, set the Saved property of the Normal.dot template to True as follows:
Application.NormalTemplate.Saved = True
*****
That in effect makes Word think that the Normal.dot template has already been saved, so it now does not complain about it as Word closes. I verified the creation/edit time of the Normal.dot file in my Microsoft Templates folder to make sure it was truly not changed. This looks like the fix!
Frank