taget fra:
http://www.codeguru.com/forum/showthread.php?s=&postid=850088WshShell objektet har disse metoder: RegRead, RegWrite og RegDelete. Vha dette objekt slipper du fra en masse API, men derimod bliver du nødt til at tilføje en reference til Windows Script Host Model. her er et eksempel, taget direkte fra siden:
Private Sub Command1_Click()
'Add a reference to Windows Script Host Model
Dim objReg As New WshShell
Dim strKey As String
'This key will be created by SaveSetting in a second
strKey = "HKEY_USERS\.DEFAULT\Software\VB and VBA Program Settings\REGTEST\TESTSECTION\TESTKEY"
'This save the settings to the registry at a specific VB key
SaveSetting "REGTEST", "TESTSECTION", "TESTKEY", "Test Value"
'It read that specific VB Key
MsgBox objReg.RegRead(strKey), , "We just set this value with SaveSetting"
'Now it overwrite the value
objReg.RegWrite strKey, "Test Value modified by RegWrite"
'Read it again
MsgBox objReg.RegRead(strKey), , "Value using WshShell.RegRead"
MsgBox GetSetting("REGTEST", "TESTSECTION", "TESTKEY"), , "Value with GetSetting"
'Now Delete the Key, notice I delete the whole section and not just the key
objReg.RegDelete "HKEY_USERS\.DEFAULT\Software\VB and VBA Program Settings\REGTEST\"
'Read it again, but it don't exist anyway
MsgBox objReg.RegRead(strKey), , "This line return an error"
Set objReg = Nothing
End Sub
Jeg har selv brugt denne metode og har ikke haft problemer med den.