除錯在這個方法里卡死 一步一步 走 能通過 不打斷點就卡死
Function ForEachArray(arrayInfo As Object) As String
Dim arr As Dictionary
Dim str As String
Dim i, j, p As Variant
For Each i In arrayInfo
If i("Key") = "status" Then
Set j = i("Items")
For Each p In j
If p("Value") = "1" Then
str = p("Count")
End If
Next p
End If
Next i
ForEachArray = str
End Function
資料 大概是這樣
{
"Key": "status",
"Items": [
{
"Value": "2",
"Desc": "無效",
"Count": 1
},
{
"Value": "4",
"Desc": "不定",
"Count": 2
},
{
"Value": "1",
"Desc": "有效",
"Count": 21
}
]
}
uj5u.com熱心網友回復:
看著沒毛病啊。不打斷點就卡死,單步能通過。
從這個資訊來判斷,是不是在回圈執行程序中,其它行程在修改資料?
單步除錯時,其它行程沒有啟動。
uj5u.com熱心網友回復:
感覺你的回圈有問題,找到str的值應該退出回圈了。還有單步運行看看回圈是不是在重復讀取,就是讀了一遍又從開始再讀一遍的死回圈。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/7356.html
標籤:VBA
上一篇:求VBA高手指點
下一篇:VBA呼叫cmd命令中的問題
