Write to registry problem

T

Tim

Hi folks,

I used the following code to read and write a value from and to registry in
Access 2002. But it put the value to “HKeys_Users\...\VB and VBA Program
Settings\â€. Could anyone tell me how to fix it?

Thanks in advance.

Tim.

SaveSetting "HKEY_CURRENT_USER\Software\Adobe", "Acrobat PDFWriter",
"bExecViewer", 0
Debug.Print GetSetting(appname:="Adobe", Section:="Acrobat PDFWriter", _
Key:="bExecViewer", Default:=0)
 
D

Dirk Goldgar

Tim said:
Hi folks,

I used the following code to read and write a value from and to
registry in Access 2002. But it put the value to "HKeys_Users\...\VB
and VBA Program Settings\". Could anyone tell me how to fix it?

Thanks in advance.

Tim.

SaveSetting "HKEY_CURRENT_USER\Software\Adobe", "Acrobat PDFWriter",
"bExecViewer", 0
Debug.Print GetSetting(appname:="Adobe", Section:="Acrobat
PDFWriter", _ Key:="bExecViewer", Default:=0)

The built-in SaveSetting and GetSetting functions always write and read
from a particular subtree. as you've noted. If you want to work with a
different part of the registry, you can probably adapt Karl Peterson's
VB code posted here:

http://vb.mvps.org/samples/project.asp?id=RegSettings
 
T

Tim

Hi Dirk,

Thanks for your quick respone. But I don't have VB install in my system. I
can't view the code. Do you have some code write in VBA?

Thanks in advance.

Tim.
 
T

TC

His class module is near as dammit to VBA. Just delete the first few
"VB ish" lines, the rest will probably be AOK.

Remember that microsoft are tightening up on where you can write in the
registry. For example, HKLM/Software/<company>/<product> used to be
fine, but in windows xp and later, you can't write there fom a
non-Administrative account, unless you change the default permissions
on that key.

HTH,
TC [MVP Access]
 
T

Tim

Hi TC,

I imported the file to my database. When I compiled the module, I got error
message “variable not define†and “App†was highlighted. Could you help me
to fix it?

Thanks for your time.

Tim.
 
T

Tim

Dirk,

Thanks for your response. I still can't get it even I follow your
direction.

Thank you for your time and help.

Tim.
 
D

Dirk Goldgar

Tim said:
Dirk,

Thanks for your response. I still can't get it even I follow your
direction.

So what have you got? If you post the code you're using and tell what
errors you're getting, we can probably figure out how to fix it.
 

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