Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 362
  • Last Modified:

Creating a space deliminated file from Exel worksheet

I need to create a space deliminated file from a excel worksheet.  I already know what the character  fixed lengths must be for trhe file, and have in my spreadsheet data for all those fields.  The programs I have are MS Excel, MS Access and MS Fox Pro.
1 Solution
long winded method

use MS Access, create a link to that excel spreadsheet (File/Get External Data/Link)

then u can export from Access, and use that linked excel spreadsheet as a table
right click on that linked table, select export, select type (.txt, .csv etc)
it should bring up some dialogs, select delimited, click on Advanced and set your options

follow this link:


Chetan Sachdeva
I would use the VBA code to do this.  Simlpy create a nested loop to write to a file using open, print #, close. At each print cycle, add a space " " or chr equivelent.

open myfile.txt for output as #1
For r = 1 to (number of rows)
      For c = 1 to (number of columns)
            print #1, cells(r,c).value & " " 
      next c
next r
close #1
msgbox "Done! Thank you Thom Wright!"

This may not produce the exact ouput you want, but you get the idea. I would go one step further and add everything to a subscripted array first then print the output of the array strung togher in a string variable.  

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now