I have one of the weirdest problems I've seen in a long time - a simple variable assignment is suddenly not working.
My app has a few values in the registry, and deals with them on startup. Simple routine:
It has been working for years with not the slightest issue, but in the last few days, it has started failing. This line
has suddenly stopped working, and only on some machines. One last week, another Monday, a third one joined in yesterday and a fourth one just now. When I stop the code and do a print of gbl_SH.RegRead(RegKey) in the immediate window, it shows the value correctly - a short text string. When I manually assign that text string to the value RegKeyRead in the immediate window, the routine continues on and returns that value to the calling code. But that simple assignment in code just doesn't work. After executing that line, RegKeyRead remains an empty string, and naturally, subsequent operations fail, since they rely on that value being retrieved properly.
When I skip over the 'On Error Resume Next' statement, it throws an error - 91, Object variable not set. But it IS set. The immediate window confirms it, by returning False to the command ?gbl_SH Is Nothing. And again, ?gbl_SH.RegRead(RegKey) shows the correct value, properly retrieved from the registry.
I don't even know where to start looking for a solution. gbl_SH.RegRead(RegKey) retrieves and correctly displays the value, but the simple assignment of that value to a text string variable fails.
My app has a few values in the registry, and deals with them on startup. Simple routine:
Code:
Public Function RegKeyRead$(ByVal RegKey$)
' Reads registry key RegKey, if key doesn't exist, return value is ""
On Error Resume Next
RegKeyRead = gbl_SH.RegRead(RegKey)
On Error GoTo 0
End Function
Code:
RegKeyRead = gbl_SH.RegRead(RegKey)
When I skip over the 'On Error Resume Next' statement, it throws an error - 91, Object variable not set. But it IS set. The immediate window confirms it, by returning False to the command ?gbl_SH Is Nothing. And again, ?gbl_SH.RegRead(RegKey) shows the correct value, properly retrieved from the registry.
I don't even know where to start looking for a solution. gbl_SH.RegRead(RegKey) retrieves and correctly displays the value, but the simple assignment of that value to a text string variable fails.