Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Registry Read methood

Status
Not open for further replies.

tedi1

Technical User
Aug 25, 2002
87
0
0
IL
Hi,

I'm running the function bellow and I'm getting an err on a problem with the methood or with the object.
I have debuged the function and saw that the Object is being created (or at least it pass the object creation stage).
The methood step issues an err.
This is the function code:
Private Function RegRead(ByVal regpath)
Dim objShl
Set objShl = CreateObject("wscript.shell")
RegRead = objShl.RegRead(regpath)
Set objShl = Nothing
End Function
 
this is the value:
GetJavaVersion = CDbl(RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\CurrentVersion"))
 
Is that an actual key with an associated value, or is it a hive containing a group of keys?
 
This is the actual key and doesn’t contain a group of keys.
Some thing else that I think is connected is that when I try to reach the method I can't do that. Meaning when I write "objShl." I don't get the list of methods.

 
Some thing else that I think is connected is that when I try to reach the method I can't do that. Meaning when I write "objShl." I don't get the list of methods.

Intellisense doen't work with late bound objects, but it shouldn't affect the operation.


What error do you get?
Have you tried the following?
Code:
GetJavaVersion = CDbl(RegRead("HKLM\SOFTWARE\JavaSoft\Java Runtime Environment\CurrentVersion"))
instead of
Code:
GetJavaVersion = CDbl(RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\CurrentVersion"))




Take Care

Matt
If at first you don't succeed, skydiving is not for you.
 
Hi,

Sorry for the dealy in my answer.
The err I'm Getting is on the line:
RegRead = objShl.RegRead(regpath)

The err message is: "Run-Time error '-2147024894 (80070002)':
Method '~' or object '~' failed"
 
Correction:

Method '~' of object '~' failed

instead of

Method '~' or object '~' failed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top