I have some templates whcih use the same information for a user, at
least most of the time. the idea is that the user can select to save
his details for later reuse. This is done using a check box on a
userform associaed with the template. I decided that the best thing to
do woudl be to save the values in the user's Normal template, since
this is their private template. So logically the macro in any template
where this is applicable should do this:
If saveforlater = true
if field(s) don't exist in normal.dot
create them
end if
update field(s) in Normal.dot using entered details (from user
form)
save normal.dot
end if
My questions are this:
1. if I refer to "Normal.dot" will Word find it wherever it is (some
users having it in odd places). I am assuming the answer is yes since
it will be open and therefore Word must know about it. Otherwise do I
need to refer to the full file location and how do I find that out.
2. Since Normal is open, because Word does this on load how do I save
it? I thought the code would be something like this:
"Normal.dot".CustomDocumentProperties.Add _
Name:="test01", _
LinkToContent:=False, _
Value:="<empty>", _
Type:=msoPropertyTypeString
but this causes a complaint because of Normal being open.
thank you.................. liz
Doug Robbins - Word MVP - 20 Aug 2007 11:36 GMT
Check out the use of the System.PrivateProfileString

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
>I have some templates whcih use the same information for a user, at
> least most of the time. the idea is that the user can select to save
[quoted text clipped - 32 lines]
>
> thank you.................. liz
liz@TheTangoClub.com - 20 Aug 2007 12:02 GMT
> Check out the use of the System.PrivateProfileString
>
[quoted text clipped - 46 lines]
>
> > thank you.................. liz
Doug,
Thank you, I was avoiding this because I understood from some other
reading that PrivateProfileString doen't work consistently and is
avioded by other experts. Therefore I thought using Normal was a more
reliable solution and also it means that the user can inspect his own
settings. So if there's a way to use it I'd rather.
Any other advice on the original questions?
thanks............... liz
Doug Robbins - Word MVP - 20 Aug 2007 12:54 GMT
Well, I have never had a problem with it, but Jonathon says that he has.
Anyway, there are certainly more ways than one to skin a cat, but I would
say that using the Normal.dot template as you had originally suggested would
not be one of the better ones.

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
>> Check out the use of the System.PrivateProfileString
>>
[quoted text clipped - 58 lines]
>
> thanks............... liz
Jonathan West - 20 Aug 2007 12:17 GMT
>I have some templates whcih use the same information for a user, at
> least most of the time. the idea is that the user can select to save
[quoted text clipped - 3 lines]
> this is their private template. So logically the macro in any template
> where this is applicable should do this:
If you want to store small quantities of per-user information, then I would
recommend using the GetSetting and SaveSetting commands, which store
information in the user portion of the registry.
I would recommend not using the PrivateProfileString property. I have found
that occasionally it seems to throw an error for no good reason. If you want
to use an INI file to store information, look up Karl Peterson's class
module which reads and writes INI files.
http://vb.mvps.org/samples/project.asp?id=kpIni

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