Working with Signature Lines

Hi Gary,

Sorry about the problems - let me try to give some of the horrible detail.

Just to explicitly rule out the situation (this can always be addressed later) the code does not deal with the case of a new document being created based on the template - and this may cause some problems in testing.

The Document_Open routine in the Template should run when either an existing document based on the template is opened, or when the template itself is opened for editing. All should be fine when it's a document being opened.

Often (as in this case - where running the open code would mean taking explicit action later to avoid the variables being saved) the code is not relevant when the template itself is being opened for editing and, so, I have explicitly bypassed it with this line

Code:
If ActiveDocument Is Me then Exit Sub

The Document_Close routine runs when a document based on the template, or the template itself is closed. Again, all should be well when it's a document (and the Document_Open code has run when it was opened).

When the template has been opened for editing and is then closed, the Close code runs and I would like to begin with the same escape line as above, BUT ...

What appears to be a bug with documents based on your template, and, I am guessing, with such locked documents in general is that, in the Close event (and maybe elsewhere) ActiveDocument is returning the template instead of the document. Having a check for the active document being the template, thus, means that the code doesn't ever run and so I have had to take that line out.

One effect of this is that when you have edited the template, the Close code tries to run, and fails. This is annoying but you can just cancel the code when this happens. Something better clearly needs to be found for a live situation!

One final point - as I said above I have explicitly excluded the creation of new documents. When a new document is created, the Open event code does not run (the Document_New event runs instead). This means that the same error can occur when the Close event runs but the Open hasn't run. Again, in testing, this an be skipped over.

Sorry it's rather a mess. I will try to produce something more solid later.
 
Guys, I'm still paying attention here, but not being a Word coder, I'm going to let Tony have run with this until we get to the email stage.

I still think, though, that if you actually get the Sharepoint workflows set up in your environment, they'll solve this issue for you. In fact, according to what I've been told, this is one of the major areas that they are supposed to really shine at. I don't actually have Sharepoint, and I'm sure it's not as easy as what I've been led to believe, but from what I've heard they work like this: Email is sent from whomever with "follow up" schedule. If reply not recieved in x hours/days/weeks etc, then follow up emails are automatically sent.

Again, probably not totally as easy at that, but at the end of the day it sounds like Sharepoint may be the right product for this situation. You're going to need to do a lot of work to hack together a custom solution.

At the same time, if you'd rather have custom, we'll do our best to help, I just want you to be aware of all the options at your disposal. :)
 
Tony, thanks for the clarification with the existing code, I need to mull it over some more to get the complete picture.

Ken, it turns out that we do use Sharpoint, but on a remote server. It may take a while to gain access, create a Sharepoint Site and setup workflows to manage the process. One drawback I see immediately is a lack of local control. For now, I would still like to persue a custom solution.

Thanks again for all your continued help and support. Once again, you guys offer such great feedback.
 
I haven't forgotten this, and do hope to post a working template soon, but it's causing me no end of headaches! Things that I expect to work, just don't and I can't pin down exactly why (I think there are probably several bugs in a little used part of Word). The more I find out, though, the more I think Ken is right and that SharePoint Workflows are the thing to use.
 
Just checking in, anymore thought on this issue? Many Thanks!
 
Sorry, Gary, without access to Sharepoint and lacking Tony's Word knowledge, I don't think I'm going to be much help to you on this one. :(
 
Back
Top