I have been using this method to store user defaults for client templates. In
probably 8 years I've never had a problem with it. Now, I've had two testers
run into problems where the .ini file doesn't seem to be storing, or if it
does, it's not where I expect it to be. Since the client is in another city,
I can't just sit at their PCs and figure out what's going on, so wonder if
anyone here might have experienced any problems with this method. Word 2003.

System.PrivateProfileString _
("c:\" + vUser, "CHRTemplates", Key) = Value

sGetProfile = System.PrivateProfileString _
("c:\" + vUser, "CHRTemplates", Key)

vUser is Application.UserName

--
Colleen

Re: PrivateProfileString by Jay

Jay
Wed Aug 17 19:20:30 CDT 2005

On Wed, 17 Aug 2005 10:57:09 -0700, Colleen M
<ColleenM@discussions.microsoft.com> wrote:

>I have been using this method to store user defaults for client templates. In
>probably 8 years I've never had a problem with it. Now, I've had two testers
>run into problems where the .ini file doesn't seem to be storing, or if it
>does, it's not where I expect it to be. Since the client is in another city,
>I can't just sit at their PCs and figure out what's going on, so wonder if
>anyone here might have experienced any problems with this method. Word 2003.
>
> System.PrivateProfileString _
> ("c:\" + vUser, "CHRTemplates", Key) = Value
>
> sGetProfile = System.PrivateProfileString _
> ("c:\" + vUser, "CHRTemplates", Key)
>
>vUser is Application.UserName

Maybe Application.UserName is returning an empty string or something
that isn't valid in a filename.

More probably it's external to Word: Do the users have read/write
access to the root directory? Is there some antivirus or antispyware
application that's interfering?

Are there any messages, or anything in the Event Log (Application or
System)? Does a full-drive search turn up the file, or any file with
the expected contents, in an unexpected place?

Have you considered writing the value to the registry instead of an
external file? PrivateProfileString will do that if you pass an empty
string ("") as the first parameter.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org

Re: PrivateProfileString by ColleenM

ColleenM
Wed Aug 17 21:13:03 CDT 2005

Thanks, Jay. Turns out the answer is one you suggested: that the users in
question don't have read/write access to the root of c:

I think next time I have a project to do I'll explore using the registry.
--
Colleen


"Jay Freedman" wrote:

> On Wed, 17 Aug 2005 10:57:09 -0700, Colleen M
> <ColleenM@discussions.microsoft.com> wrote:
>
> >I have been using this method to store user defaults for client templates. In
> >probably 8 years I've never had a problem with it. Now, I've had two testers
> >run into problems where the .ini file doesn't seem to be storing, or if it
> >does, it's not where I expect it to be. Since the client is in another city,
> >I can't just sit at their PCs and figure out what's going on, so wonder if
> >anyone here might have experienced any problems with this method. Word 2003.
> >
> > System.PrivateProfileString _
> > ("c:\" + vUser, "CHRTemplates", Key) = Value
> >
> > sGetProfile = System.PrivateProfileString _
> > ("c:\" + vUser, "CHRTemplates", Key)
> >
> >vUser is Application.UserName
>
> Maybe Application.UserName is returning an empty string or something
> that isn't valid in a filename.
>
> More probably it's external to Word: Do the users have read/write
> access to the root directory? Is there some antivirus or antispyware
> application that's interfering?
>
> Are there any messages, or anything in the Event Log (Application or
> System)? Does a full-drive search turn up the file, or any file with
> the expected contents, in an unexpected place?
>
> Have you considered writing the value to the registry instead of an
> external file? PrivateProfileString will do that if you pass an empty
> string ("") as the first parameter.
>
> --
> Regards,
> Jay Freedman
> Microsoft Word MVP FAQ: http://word.mvps.org
>