ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Best Way to Read the Registry? (https://www.excelbanter.com/excel-programming/314511-best-way-read-registry.html)

JK

Best Way to Read the Registry?
 
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



Dave Peterson[_3_]

Best Way to Read the Registry?
 
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 "".



JK wrote:

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


--

Dave Peterson


Ron de Bruin

Best Way to Read the Registry?
 
Hi JK

Maybe you can use this
http://www.rondebruin.nl/register.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl


"JK" wrote in message news:WjCed.7231$5O4.5527@trnddc07...
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




JK

Best Way to Read the Registry?
 
Thank you Ron and Dave.

"JK" wrote in message news:WjCed.7231$5O4.5527@trnddc07...
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





All times are GMT +1. The time now is 03:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com