Visual Basic for Applications/Array Data To Immediate Window

Summary
'''This VBA code module allows the listing of arrays in the immediate window. So that the user can see examples of its use, it makes use of various procedures that fill the array for demonstration and testing. The VBA code runs in MS Excel but is easily adapted for any of the MS Office products that run VBA.''' Clearly, mixed data varies in length and in its number of decimal points. This module displays the array neatly taking account of the variations that might otherwise disrupt the layout. It can decimal point align the data or not, according to internal options.

Code Notes

 * DispArrInImmWindow is the main procedure. It formats and prints data found on the two dimensional input array. It prints on the VBA Editor's Immediate Window.   Options include the printing of data as found or making use of decimal rounding and alignment. The entire output print is also available as a string for external use.  The process depends on monospaced fonts being set for any display, including the VBA editor.
 * RndAlphaToArr, RndNumericToArr, and RndMixedDataToArr load an array with random data. The data is random in the content and length of elements, but in addition, numerics have random integer and decimal parts.  Each allows adjustment of options internally to accommodate personal preferences.
 * TabularAlignTxtOrNum is not used in this demonstration. It is included for those who prefer to format each individual column of an array during the loading process. Its input variant takes a single string or number and returns the formatted result in a user-set fixed field width. The number of decimal places of rounding can be set.   Note that when all data in a column of a numeric array is loaded with the same parameters, the result is always decimal point alignment.
 * WriteToFile is a monospaced font, text file-making procedure. If the file name does not exist, it will be made and saved automatically. Each save of text will completely replace any previously added. It is added here in case a user needs to save an output greater than that possible for the Immediate Window.   The Immediate Window is limited to about two hundred lines of code, so large arrays should make use of the main procedure's sOut string. Again, wherever outputs from the main procedure are used, monospaced fonts are assumed.
 * Note that the user might add a procedure to export large values of sOut, the formatted string, to the clipboard. Procedures exist elsewhere in this series that will accomplish this.

The VBA Module
Copy the entire code module into a standard VBA module, save the file as type .xlsm and run the top procedure. Be sure to set monospaced fonts for the VBA editor or the object will have been defeated.

Updates

 * 26 Nov 2019: Adjusted DispArrInImmWindow code to better estimate maximum column width, taking account of imposed decimal places.