As a response to a POST, the server returns very simple JSON object that can indicate success or failure of the upload.
The JSON object can be either {config_version:N} to indicate success or {exception:Reason} to indicate failure.
I process the response in the following manner:
json = objHTTP.responseText
Set sc = CreateObject("ScriptControl")
sc.Language = "JScript"
Set o = sc.Eval("(" + json + ")")
On Error GoTo Exception:
' try to use config_version property
Util.SetConfigData "version", o.config_version
Exit Function
Exception:
If o.Exception = "config_not_valid" Then
' one kind of exception - do accordingly
Else
' another kind of exception
End If
The problem that I am facing is that the VBA Excel 2010 editor is capitalizing o.exception to o.Exception! In the Watch window I see the property exception but cannot access it. How can I force the Editor to stop capitalizing the property name? Is there other syntax for accessing properties in VBA?
EDIT: To better illustrate what is happening here are two screen shots.

As you can see, the o has a property called exception. When trying to access it with o.Exception it triggers the 438 error.

Since I have control over the backend, I changed the response to return {Exception:whatever} (cannot do it permanently). Now VBA has no problem picking the property.
How is this possible if the VBA compiler is case-insensitive as suggested by Jean-François Corbett?
This is wierd. I can get the lower-case “e” to stick in Tester(), but if I change the declaration of “exception” in Test2() to “Exception”, then the VBE automatically changes changes any instances in Tester() to “Exception”. Changing back to “exception” has the reverse effect.
Basically you need to make sure you’re not using “Exception” anywhere else in your project.
EDIT:
If you’re still stuck then you can try it this way, leaving your parsed JSON object in the script control instance: