adding multiple messgeboxes values to single messagebox in vba

后端 未结 2 1835
予麋鹿
予麋鹿 2021-01-27 07:25

I have this code with me where i can display the message when every outer loop ends. I want to catch all these messages in suppose array or soome list like structure and then at

2条回答
  •  爱一瞬间的悲伤
    2021-01-27 07:46

    instead of calling msgboxes, create a String and keep adding the messages - at the end of code msgbox(yourString)

    for example decalare a string before the main sub

    Dim yourFinalMessage As String ' or Dim yourFinalMessage$
    

    instead of

    MsgBox "No Appointments items in " & objNavFolder.DisplayName & "'s folder"
    

    say

    yourFinalMessage = yourFinalMessage & vbCrLf & & _ 
                 "No Appointments items in " & objNavFolder.DisplayName & "'s folder"
    

    keep doing this until the loop ends.

    at the end of loop say

    msgbox YourFinalMessage 
    

提交回复
热议问题