Best Way to Read the Registry?

  • Thread starter Thread starter JK
  • Start date Start date
J

JK

My application must read the registry and confirm the presence of a value.

So I turned to John W's syntex. Unfortunately, he doesn't give an
"If...Else...End If" example to read the registry. In any case, the syntex
works when the value is present. However, I am using an error handler to
tell me when the value is NOT present. Is this correct? Or can someone
suggest an "If...Else...End If" procedure that wouldn't require the use of
an error handler.

Thank you in advance.

Jim Kobzeff
 
Are you refering to John Walkenbach's tip from:

http://j-walk.com/ss/excel/tips/tip60.htm

If yes, then notice these two lines:

' Get setting from registry
Counter = GetSetting("XYZ Corp", "Budget", "Count", 0)
LastOpen = GetSetting("XYZ Corp", "Budget", "Opened", "")


The last parm passed to the GetSetting is the default value if that key hasn't
been set. See VBA's help for more info.

In this example, if Counter wasn't found, it'll be 0. If LastOpen wasn't found,
it'll be "".
 

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

Back
Top