'Way to output more than the maximum character limit in a msgbox?
I need to display a rather long message to the user in a msgbox. However there are instances where the msgbox seems to hit it's character limit. What's a solution to this?
Solution 1:[1]
I used objShell.Popup to achieve this
Set objShell = CreateObject("Wscript.Shell")
    objShell.Popup messagehere
Solution 2:[2]
use Wscript.Echo message instead of MsgBox message
Solution 3:[3]
With CreateObject("wscript.shell")
.Popup b
End With
where b is the variable that has all the contents that you need to display in your messagebox.
Solution 4:[4]
You may have a look at my Common-VBA-Message-Service.The message has practically no limit and the message window expands up to 85% of the screen's width and height.
Solution 5:[5]
Here is a way to work around the 1023 character limit:
Sub testWSHEnvironment()
    Dim WshShell  As IWshRuntimeLibrary.WshShell, WshSysEnv  As _
        CIWshRuntimeLibrary.WshEnvironment
    Set WshShell = CreateObject("WScript.Shell")
    Set WshSysEnv = WshShell.Environment("SYSTEM")
    theList = "Environmental Variables:"
    theCount = 0
    For Each thisItem In WshSysEnv
        If (Len(theList) + Len(CStr(theCount)) + 4 + Len(thisItem) > 1023) Then
            MsgBox theList
            theList = "More Variables:"
        End If
        theCount = theCount + 1
        theList = theList & vbCrLf & theCount & ": " & thisItem
    Next thisItem
    MsgBox theList
End Sub
This will generate as many MsgBox popups as you need to display the list of environmental variables. Note that you need to include 4 in the sum in order to take into account the vbCrLf = CarriageReturn/LineFeed and ": " for each item in the list.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source | 
|---|---|
| Solution 1 | asdfasfd | 
| Solution 2 | Zohaib Hamdulay | 
| Solution 3 | Souvik | 
| Solution 4 | Walter Rauschenberger | 
| Solution 5 | JDMorganArkansas | 
