savesetting and getsetting

A

Anthony

I have written some VBA modules in Word 2000 to enable me
to save certain text strings in the Registry (using the
Savesetting command). I then use Getsetting to insert
these strings as and when required into Word documents
(the strings are things like Company name, Phone number
etc). This worked fine until recently. Now, whenever I
open or close a document based on one of my templates, the
data in the registry get deleted (ie the keys are still
there but the value fields are empty).

There has been a big change recently because my computer
crashed and I had to reinstall everything, so I upgraded
to Windows XP Professional (previously I was using XP
Home). I am also now using Kaspersky anti-virus rather
than McAfee (although I have disabled it and the problem
still occurs so I don't think it is the virus software).

Can anyone explain what is going on? Thank you
 
P

Peter Hewett

Hi Anthony

You need to do some basic problem determination. Since you have not said I presume the
code is running without producing any errors?

Firstly create a new procedure using the parts of your code that create and read the
registry key. Use this code to write data to the registry and then immediately read it
back. Do you get back what you wrote? If no then you need to try to manually update the
registry key and see if that works. If that does not work then I'm stumped unless it's a
security/access related problem. If you can write/read the correct data then you need to
determine the differences between your "real" code and your test code.

HTH + Cheers - Peter
 
A

Andrew Cushen

Anthony-

You may be running into a Security issue. If you're not
logged into WinXP Pro with Administrator privileges (which
you shouldn't be, for everyday work), your code may not
have the rights required to read certain parts of the
Registry. You may have to resort to using the Registry
APIs to save your settings to a part of the Registry that
you don't need Admin rights for.

There is an excellent VB class for reading & writing non-
Binary Registry info to any part of the Registry, that
encapsulates the API functions, at:

http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/dnovba01/html/RegistryMadeEasy.asp
-that should all be on one line.

Try that code; you may have to experiment to discover which
Hives of the Registry require lower Access rights.

Using the APIs may enable you to get around the problem
even if the cause is not what I suspect.

HTH,

-Andrew
=================================================
 

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