How can show all output in only one message box or window?

I want to show which type is in every cell at range a1-a7:

image

Sub CheckCellType()
    Dim oDoc As Object
    Dim oSheet As Object
    Dim oCell As Object

    oDoc = ThisComponent
    oSheet = oDoc.CurrentController.ActiveSheet 
    for i =0 to 6
    oCell = oSheet.getCellByPosition(0, i)
    Select Case oCell.Type
        Case com.sun.star.table.CellContentType.EMPTY
            MsgBox "Cell is Empty"
        Case com.sun.star.table.CellContentType.VALUE
            MsgBox "Cell contains a Value (Number, Date, Boolean)"
        Case com.sun.star.table.CellContentType.TEXT
            MsgBox "Cell contains Text"
        Case com.sun.star.table.CellContentType.FORMULA
            MsgBox "Cell contains a Formula"
        Case Else
            MsgBox "Unknown Cell Type"
    End Select
    next i
End Sub

The message box pop up for 7 times,how can can show all output in only one message box or window ?

REM  *****  BASIC  *****

Sub CheckCellType()
    Dim oDoc As Object
    Dim oSheet As Object
    Dim oCell As Object
    Dim sOutput As String

    oDoc = ThisComponent
    oSheet = oDoc.CurrentController.ActiveSheet 
    sOutput = "Results: "
    for i =0 to 6
    oCell = oSheet.getCellByPosition(0, i)
    Select Case oCell.Type
        Case com.sun.star.table.CellContentType.EMPTY
            sOutput = sOutput + chr(13) + "Cell" + i + ": " + "Cell is Empty"
        Case com.sun.star.table.CellContentType.VALUE
            sOutput = sOutput + chr(13) + "Cell" + i + ": " +  "Cell contains a Value (Number, Date, Boolean)"
        Case com.sun.star.table.CellContentType.TEXT
            sOutput = sOutput + chr(13) + "Cell" + i + ": " +  "Cell contains Text"
        Case com.sun.star.table.CellContentType.FORMULA
            sOutput = sOutput + chr(13) + "Cell" + i + ": " +  "Cell contains a Formula"
        Case Else
           sOutput = sOutput + chr(13) + "Cell" + i + ": " +  "Unknown Cell Type"
    End Select
    next i
    MsgBox sOutput
End Sub

You need to collect your data, for example in a string named msg.
Before you start the loop set this to be empty.
msg = ""
.
Then replace your various MsgBox-calls with extending msg
msg= msg + "Cell is Empty" + " / "
.
After the loop place a new MsgBox msg
.
Start optimizing by adding cell-references or replacing my / with a line-break etc.

PS: Long ago there were very complicated command-line interfaces available. There you would have used only print instead of your MsgBox…

Dim msg(6) as String

msg(i) = "Cell ... "

MsgBox join(msg(), chr(13) )

https://wiki.documentfoundation.org/Documentation/BASIC_Guide#Arrays #Arrays
Join Function