.ini file to check version of document

W

Writer

Hi there,

I am looking for someone who can suggest ways of setting up an ini file
that is called by
a few lines of code in the beginning of every template so that when the
user accesses the document, they will be advised on whether it is the
latest version or not.

The .ini file will contain all the latest names of the templates so
that these filenames can be compared against the filenames of the
latest documents stored on the network. If there is no match then the a
MsgBox will advise this document template is not the latest tempate, or
rather something like:

"Template 5.2.7 has been replaced by Template 5.2.8"
"Please access P:\ to locate the lastest version"

Any ideas (on doing this in Word VBA of course)?

Thanks,
Nikki :)
 
J

Jonathan West

Hi Nikki,

It seems to me that for the amount of effort involved in making sure an
up-to-date version of this INI file is available to everyone, you could just
as easily make sure that up-to-date versions of the templates themselves are
distributed.

Certainly what you are asking for is possible - you would create an add-in
that has an event triggered when a document is opened or created. See this
article.

How to create global event procedures similar to AutoOpen, AutoNew and
AutoClose, without using Normal.dot
http://www.word.mvps.org/FAQs/MacrosVBA/PseudoAutoMacros.htm

In that event, you can check the documents' AttachedTemplate property, and
you can or instance read a version number from a custom property in the
attached template (using the CustomDocumentProperties collection) and so
compare it to the value read from the ini file.

But I would recommend you just ensure the templates are kept up-to-date in
the first place.

--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 
N

Nikki

Hi Jonathan,

We are pulling our templates from Sharepoint where they are stored in a
template library. When the template is opened by the user in Word, a new
docment based on the template from Sharepoint, is opened and it seems that
Sharepoint allocates the document a 'temporary number' ie..
8776RY.dot - this number changes everytime a document based on this template
is opened. I have stored the templates in Sharepoint so that when the user
clicks on them a document, not the template is opened.

So this makes it quite tricky to work out what is being opened where... If
a user has stored a copy of the document template locally, we want to alert
them that this version is older than the one stored on the Intranet... We are
not using 'Word Versioning' in this instance but rather hoping to do version
control by inserting a hidden flag in the document somewhere and keeping a
list of current template names in an ini file somewhere to be used as
comparison. We want users to be notified that the version they are using is
old and that the new version 5.2.8 is available on the Intranet.

Does that make it clearer?
 
W

Writer

Hi Jonathan,
I thought perhaps using a manual field ie. Properties\Custom fields
use a field called say: "TemplateVer" to use as a version control
mechanism.
rather than relying on say Sharepoint and it's versioning.

the only problem is if I make a mistake then people will be confused..

N
 
J

Jonathan West

Writer said:
Hi Jonathan,
I thought perhaps using a manual field ie. Properties\Custom fields
use a field called say: "TemplateVer" to use as a version control
mechanism.
rather than relying on say Sharepoint and it's versioning.

the only problem is if I make a mistake then people will be confused..

Quite frankly, I don't think you should be allowing Sharepoint anywhere near
your templates (documents are a different matter).

If you want to ensure up-to-date templates are in use, then they have to be
distributed to each PC and put in the correct folder. it is no more trouble
to do this than to make sure each PC has an up-to-date INI file listing the
current versions of the templates.

Provided that you have a machanism for pushing out updated templates, it
doesn't matter too much what mechanism you have for identifying which
template is actually in use, through a custom document property giving the
version is a good method, one i use on my own templates.
 
W

Writer

Thanks John,
N :)
Jonathan said:
Quite frankly, I don't think you should be allowing Sharepoint anywhere near
your templates (documents are a different matter).

If you want to ensure up-to-date templates are in use, then they have to be
distributed to each PC and put in the correct folder. it is no more trouble
to do this than to make sure each PC has an up-to-date INI file listing the
current versions of the templates.

Provided that you have a machanism for pushing out updated templates, it
doesn't matter too much what mechanism you have for identifying which
template is actually in use, through a custom document property giving the
version is a good method, one i use on my own templates.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top