Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8824789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:43:16+00:00 2026-06-14T06:43:16+00:00

I have three dimensional data that I want to write into file in VBA.

  • 0

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)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T06:43:17+00:00Added an answer on June 14, 2026 at 6:43 am

    I would use the Scripting Runtime library. You could do a simple tab delimited file. If you want you could reference the Scripting library directly in the VBE editor:
    Tools->Reference->Microsoft Scripting Runtime

    Here’s some untested code you could go off of:

    Dim fso As FileSystemObject
    Dim oFile As TextStream
    Dim iTime As Integer, iSpace As Integer
    
    Set oFile = fso.CreateTextFile(stringPath)
    
    For iTime = 1 To UBound(A)
        For iSpace = 1 To UBound(A, 2)
            oFile.WriteLine (iTime & vbTab & iSpace & vbTab & A(iTime, iSpace))
        Next iSpace
    Next iTime
    
    oFile.Close
    Set oFile = Nothing
    

    For late bound reference to library see:
    How to create and write to a txt file using VBA

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have three divs in a container that I want to float over a large
I have a more dimensional php array that i want to pass to a
I have a multi-dimensional array that I want to print statistics from for a
I want to save data to a file in my elisp program. I have
I have a one dimensional vector of data in R and I want to
I have a three dimensional ndarray of 2D coordinates, for example: [[[1704 1240] [1745
i have a three dimensional bit table array as bit_table[dim1][100][200]; The second and third
i am using visual studio 2010. i have a three dimensional structure array which,
I have a dataset consisting of a large collection of points in three dimensional
I have the following three arrays and need to create a new two-dimensional array

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.