Creating a space deliminated file from Exel worksheet

Posted on 2006-05-10
Last Modified: 2008-02-26
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.
Question by:steveLaMi
    LVL 65

    Accepted 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

    LVL 11

    Expert Comment

    LVL 4

    Expert Comment

    follow this link:

    Chetan Sachdeva
    LVL 3

    Expert Comment

    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.  

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    This article describes some very basic things about SQL Server filegroups.
    Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now