I have three dimensional data that I want to write into file in VBA. The data will have a time axis, a spatial axis, and a magnitude axis. So, the magnitude data would be in the form of A(space, time). Does anyone know how to “write” that into a text file in vba code? I’m not sure how to loop around “Write #1” with two indices. Thanks for helping out!
Here’s the output I’m expecting:
space1 space2 space3
time1 A(1,1) A(1,2) A(1,3)
time2 A(2,1) A(2,2) A(2,3)
time3 A(3,1) A(3,2) A(3,3)
I would use the
Scripting Runtimelibrary. You could do a simple tab delimited file. If you want you could reference theScriptinglibrary directly in the VBE editor:Tools->Reference->Microsoft Scripting Runtime
Here’s some untested code you could go off of:
For late bound reference to library see:
How to create and write to a txt file using VBA