Hi All,
I am looking for a macro that read excel or csv data based on Windows login
So column 1 has Windows Usernames and column 2 has four digit string (unique to the user) that an application needs to read at startup
Attachment 95077
The four digit string is then used by the application.
At the moment the four digit string resides in reg key and the application reads that key everytime it starts
Here is the current code:
'This macro reads the string value of "AnswerBackID" from HKEY_LOCAL_MACHINE\SOFTWARE\WRQReflection\Rwin\Reflection 2 and set the answerback to the value is reads.
Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const KEY_QUERY_VALUE& = &H1
Dim strValue As String * 256
Dim lngRetval As Long
Dim lngLength As Long
Dim hKey As Long
If RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\WRQReflection\Rwin\Reflection 2", 0, KEY_QUERY_VALUE, hKey) Then
End If
lngLength = 256
'Retrieve the value of the key
lngRetval = RegQueryValueEx(hKey, "AnswerBackID", 0, 0, ByVal strValue, lngLength)
'Close the key
RegCloseKey (hKey)
myAnswerback = Left(strValue, lngLength)
Session.Answerback = myAnswerback
End Sub
Any help would be appreciated
Thanks
Regards
I am looking for a macro that read excel or csv data based on Windows login
So column 1 has Windows Usernames and column 2 has four digit string (unique to the user) that an application needs to read at startup
Attachment 95077
The four digit string is then used by the application.
At the moment the four digit string resides in reg key and the application reads that key everytime it starts
Here is the current code:
'This macro reads the string value of "AnswerBackID" from HKEY_LOCAL_MACHINE\SOFTWARE\WRQReflection\Rwin\Reflection 2 and set the answerback to the value is reads.
Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const KEY_QUERY_VALUE& = &H1
Dim strValue As String * 256
Dim lngRetval As Long
Dim lngLength As Long
Dim hKey As Long
If RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\WRQReflection\Rwin\Reflection 2", 0, KEY_QUERY_VALUE, hKey) Then
End If
lngLength = 256
'Retrieve the value of the key
lngRetval = RegQueryValueEx(hKey, "AnswerBackID", 0, 0, ByVal strValue, lngLength)
'Close the key
RegCloseKey (hKey)
myAnswerback = Left(strValue, lngLength)
Session.Answerback = myAnswerback
End Sub
Any help would be appreciated
Thanks
Regards