+ Reply to Thread
Results 1 to 10 of 10

Exporting worksheets as Tab-Delimited text .vbs

  1. #1
    Registered User
    Join Date
    10-11-2010
    Location
    marlton nj
    MS-Off Ver
    Excel 2003
    Posts
    5

    Exporting worksheets as Tab-Delimited text .vbs

    I have an excel workbook with 3 different worksheets contained, these sheets are labeled:

    Generic, CoBrand, TriBrand what I would like to do is have a script reference the excel workbook and save each sheet as a separate tab-delimited text file.


    But to only export the Fields that have data (check against blank spaces or characters).

    we will be using the same workbook for the headers and deleting the data daily, I know that excel will still act as though data is within those fields and I can't use it if it saves multiple blank lines in the text file.

    Thanks in advance,
    Best regards,
    Joe
    Last edited by jmituzas; 10-11-2010 at 04:08 PM. Reason: solved

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Exporting worksheets as Tab-Delimited text .vbs

    "skip blanks" sounds like an easy request and it may be, but people say one thing and mean another when they say things like this.

    Please provide a sample workbook that shows data that needs "evaluating" on all 3 sheets and then examples of the resulting CSV files that you would like to see as a result of that sample data.

    In other words, do it once by hand on a small but demonstrative set of data so we can see the start and finish lines clearly. Do not dumb down the process too much, make sure the data demonstrates all the problems to overcome and your solutions manually accomplished.

    Click GO ADVANCED and use the paperclip icon to post up a desensitized copy of your files.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Exporting worksheets as Tab-Delimited text .vbs

    Meanwhile:

    I have a macro that may be "ready to use" for exporting all sheets in an Excel file each to their own CSV file.
    Sheets to CSVs



    This would be the basis for any assistance I provide, adding in whatever code is needed to exclude the rows you're going to demonstrate.

  4. #4
    Registered User
    Join Date
    10-11-2010
    Location
    marlton nj
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Exporting worksheets as Tab-Delimited text .vbs

    ok attached are the samples.

    One is the excel file the other is the text file for generic as you can see by just clicking you cursor at the bottom of the page, it contains multiple rows of nothing....
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    10-11-2010
    Location
    marlton nj
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Exporting worksheets as Tab-Delimited text .vbs

    Thanks for the link I think what i want though is the one for Sheets To TXT.

    https://sites.google.com/a/madrocket...-sheets-to-txt

    you have created a nice info site.

    This isn't setup for skip blanks, correct. Will try to figure it out.

    best regards,
    Joe

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Exporting worksheets as Tab-Delimited text .vbs

    Your sample TXT file appears to be a version of the GENERIC sheet from the XLS file. Unfortunately, nothing at all regarding blanks.

  7. #7
    Registered User
    Join Date
    10-11-2010
    Location
    marlton nj
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Exporting worksheets as Tab-Delimited text .vbs

    Quote Originally Posted by JBeaucaire View Post
    Your sample TXT file appears to be a version of the GENERIC sheet from the XLS file. Unfortunately, nothing at all regarding blanks.
    there is 10 blank lines on that .txt file...

    If you point your mouse to the bottom of the open .txt file and keep hitting the backspace key, you can see what I am referring to.

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Exporting worksheets as Tab-Delimited text .vbs

    You've got some stray garbage in cells outside your used range. Excel uses these stray cells when you save a sheet as a TXT file.

    You can run this macro on your workbook and it will clear all the stray stuff from outside the data range on each sheet.

    Please Login or Register  to view this content.

    Then when you save the GENERIC sheet it won't have those 10 blank rows at the end.

  9. #9
    Registered User
    Join Date
    10-11-2010
    Location
    marlton nj
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Exporting worksheets as Tab-Delimited text .vbs

    You are awesome!

    Thanks alot for your help!

  10. #10
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Exporting worksheets as Tab-Delimited text .vbs

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1