我有这段代码,我可以在每个外循环结束时显示消息。我想在假设数组或某种列表之类的结构中捕获所有这些消息,然后最后想将这些消息中的每一条显示到一个消息框中。如果有人能帮助我,我将不胜感激。
谢谢。
For Each objNavFolder In objNavGroup.NavigationFolders
SkippedItemCounter = 0
If oItems.Count = 0 Then
MsgBox "No Appointments items in " & objNavFolder.DisplayName & "'s folder"
Else
NextRow = NextRow + 1
For Each MyItem In oItems
If MyItem = "" Then
SkippedItemCounter = SkippedItemCounter + 1
End If
'some code here
Next
Set objExpl = _colExpl.Add(objFolder, olFolderDisplayNormal)
NextRow = NextRow - 1
End If
MsgBox "No. of items= "&SkippedItemCounter&"skipped from"&objNavFolder.DisplayName&""
Next
End If
End If
End If
不要调用 msgboxes,而是创建一个字符串并继续添加消息 - 在代码 msgbox(yourString) 的末尾
例如
在主子之前声明一个字符串
Dim yourFinalMessage As String ' or Dim yourFinalMessage$
代替
MsgBox "No Appointments items in " & objNavFolder.DisplayName & "'s folder"
say
yourFinalMessage = yourFinalMessage & vbCrLf & & _
"No Appointments items in " & objNavFolder.DisplayName & "'s folder"
继续这样做直到循环结束。
在循环结束时说
msgbox YourFinalMessage
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)