Results 1 to 3 of 3

Thread: Aaron I get and Error Add String Value and Key to HKEY_LOCAL_MACHINE

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 1999
    Location
    North East America
    Posts
    463
    Aaron I get and Error Sub or Function not Defined for the Sub. the line RegCreateKey gets highlighted

    Sub SaveRegSetting(ByVal lKey As Long, ByVal sSubKey As String, ByVal sValue As String, ByVal vData As Variant)
    'Save a String/Long Value to the Registry
    Dim lRegKey As Long
    Dim lType As Long
    Dim lData As Long
    Dim sData As String

    'Determine the type of Data being Saved
    lType = IIf(VarType(vData) = vbString, 1, 4)
    If lType = 4 Then
    'Long Data Type
    lData = vData
    Else
    'String Data Type
    sData = vData
    End If
    If RegCreateKey(lKey, sSubKey, lRegKey) = 0 Then
    'Open/Create the Registry Key
    If lType = 1 Then
    'Save the String Value to the Registry
    Call RegSetValueEx(lRegKey, sValue, 0&, lType, ByVal sData, Len(sData))
    Else
    'Save the Long Value to the Registry
    Call RegSetValueEx(lRegKey, sValue, 0&, lType, lData, 4)
    End If
    'Close the Registry Key
    Call RegCloseKey(lRegKey)
    End If
    End Sub
    TMacPherson
    MIS Systems Engineer
    [email protected]


  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    See your original thread

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 1999
    Location
    North East America
    Posts
    463
    Never mind boy do I feel like a bozzo. I put the declares in a Module and it needs to be in the form code. OOPS!!!

    Thanks for your help!
    TMacPherson
    MIS Systems Engineer
    [email protected]


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width