CodePudding user response:
CodePudding user response:
All commented On the Error Resume Next statement, running in the VBA IDE,The error and then click the debugging, the cursor will stop error in the statement,
Or
In doubt may have a logical error statements in advance to set breakpoints, run through the breakpoint interrupt,
At this point can be used in the immediate window
? The variable name
Or
? The function name () function parameter
Or
Process (parameters)
Auxiliary debugging,
CodePudding user response:
Cursor in this area shows that there is a problem, but I don't know how to modify theCodePudding user response:
Put your "class 1" parse () function code posted,Or, you set a breakpoint at line, perform there is interrupted, according to the "F8" tracking, see what line of code inside the function error,
The breakpoint is set or cancel the operation:
The cursor point on the line, and then according to the function keys "F9"; Or in the most on the left side of the yellow arrow in your figure with the mouse click,
The left has a reddish-brown dots, the code word with reddish brown background, said the breakpoint; There is no breakpoint,
In accordance with the "state" in this picture, you should press F8 can also track again into,
CodePudding user response:
Overall code below please, be solvedCodePudding user response:
You are now obj. Parse error (a), its code is needed to find reason!!!!!!!!!!What is the function declaration form, how to implement, the other people all don't know, what can solve????????
CodePudding user response:
Tracking and went in, the next step should be how to operate?CodePudding user response:
Post code, of 7th floor "text" post,It is best to use "block" enclosed, (reply to edit box, 12th icon, "smiling face" on the left side of the, behind the list, choose Visual Basic),
Chose, pay attention to is to paste your code to the cursor (that is, code text on the two "tags" in the middle of enclosed in square brackets),
CodePudding user response:
Or: where did you Copy the code? Stick the original url,CodePudding user response:
'Option Explicit
Const INVALID_JSON As Long=1
Const INVALID_OBJECT As Long=2
Const INVALID_ARRAY As Long=3
Const INVALID_BOOLEAN As Long=4
Const INVALID_NULL As Long=5
Const INVALID_KEY As Long=6
The Public Function parse (ByRef STR As String) As Object
Dim index As Long
The index=1
Call skipChar (STR, index)
The Select Case mids (STR, index, 1)
Case "{
"Set the parse=parseObject (STR, index)
Case "["
Set the parse=parseArray (STR, index)
End the Select
End the Function
Private Function parseObject (ByRef STR As String, ByRef index As Long) As the Object
The Set parseObject=CreateObject (" Scripting. The Dictionary ")
Call skipChar (STR, index)
If Mid (STR, index, 1) & lt;> "{" Then Err. Raise vbObjectError + INVALID_OBJECT, Description:=" char "& amp; The index & amp; ":" & amp; Mid (STR, index)
The index=index + 1
Do
Call skipChar (STR, index)
If "} "=Mid (STR, index, 1) Then
The index=index + 1
The Exit Do
ElseIf=", "Mid (STR, index, 1) Then
The index=index + 1
Call skipChar (STR, index)
End the If
Dim key As String
ParseObject. Add the key:=parseKey (STR, index), the Item:=parseValue (STR, index)
Loop
End the Function
Private Function parseArray (ByRef STR As String, ByRef index As Long) As a Collection
The Set parseArray=New Collection
Call skipChar (STR, index)
If Mid (STR, index, 1) & lt;> "[" Then Err. Raise vbObjectError + INVALID_ARRAY, Description:=" char "& amp; index & amp;" : "+ Mid (STR, index)
The index=index + 1
Do
Call skipChar (STR, index)
If "]="Mid (STR, index, 1) Then
The index=index + 1
The Exit Do
ElseIf=", "Mid (STR, index, 1) Then
The index=index + 1
Call skipChar (STR, index)
End the If
ParseArray. Add parseValue (STR, index)
Loop
End the Function
Private Function parseValue (ByRef STR As String, ByRef index As Long)
Call skipChar (STR, index)
The Select Case mids (STR, index, 1)
Case "{
"Set parseValue=https://bbs.csdn.net/topics/parseObject (STR, index)
Case "["
Set parseValue=https://bbs.csdn.net/topics/parseArray (STR, index)
Case, "" "" "'"
ParseValue=https://bbs.csdn.net/topics/parseString (STR, index)
Case "t", "f"
ParseValue=https://bbs.csdn.net/topics/parseBoolean (STR, index)
Case "n"
ParseValue=https://bbs.csdn.net/topics/parseNull (STR, index)
In Case the Else
ParseValue=https://bbs.csdn.net/topics/parseNumber (STR, index)
End the Select
End the Function
CodePudding user response:
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull