The Registration Seminar assumed the existance of "VB and VBA Program Settings" folder.
If this doesn't exist you can't use the built in VBA GetSetting and SaveSetting.
Instead we will need to use some Shell Scripting.
Create a Form with three textboxes
txtKey
txtValue
txtPath
Then you can add the following Code which uses the below Functions.
Private Sub cmdCreateKey_Click()
RegKeySave txtPath & txtKey, txtValue
MsgBox "Reg Key Added"
End Sub
Check the Registry Key exists.
You can add necessary checks that the path is correct and the value is correct.
Code:
Read Key
Function RegKeyRead(regKey As String) As String
Dim ws As Object
On Error Resume Next
Set ws = CreateObject("WScript.Shell")
RegKeyRead = ws.RegRead(regKey)
End Function
Sub RegKeySave(regKey As String, regValue As String, _
Optional regType As String = "REG_SZ")
Dim ws As Object
Set ws = CreateObject("WScript.Shell")
ws.RegWrite regKey, regValue, regType
End Sub
Function RegKeyDelete(regKey As String) As Boolean
Dim ws As Object
On Error GoTo ErrorHandler
Set ws = CreateObject("WScript.Shell")
ws.RegDelete regKey
RegKeyDelete = True
Exit Function
ErrorHandler:
RegKeyDelete = False
End Function
Function RegKeyExists(regKey As String) As Boolean
Dim ws As Object
On Error GoTo ErrorHandler
Set ws = CreateObject("WScript.Shell")
ws.RegRead regKey
RegKeyExists = True
Exit Function
ErrorHandler:
RegKeyExists = False
End Function