+ Reply to Thread
Results 1 to 3 of 3

saving in other File types

  1. #1
    Jason
    Guest

    saving in other File types

    hi,

    i am trying to write a code to save an excel sheet into a formatted space
    delimited file type, (.PRN). i tried to save it directly using

    workbooks.save(c:filename.prn), it saves it as prn but not the format that i
    need, i know that its possible to specify the file type, but i would be
    really thankfull if some one could help me...thanks

  2. #2
    John Keith
    Guest

    RE: saving in other File types

    Are you trying to make the output file have values that are in fixed columns?

    It is much better to use Excel VBA to read in the data from the cells, then
    output the data directly to a .TXT file where you can use string functions to
    build your output exactly the field lenghts you want, truncating any extra
    characters. (On my applications I needed this to upload excel data to a
    mainframe) PRN files were a mess to deal with; even when using a fixed font
    and trying to keep the data cells sized properly.

    Left$(vaData(lRow, 1) & Space(37), 37)
    .....to create a 37 length string right padded with spaces.
    then string the results of multiple strings to make up your file.

    Or am I missing your point (about which format you needed)?

    HTH
    --
    Regards,
    John


    "Jason" wrote:

    > hi,
    >
    > i am trying to write a code to save an excel sheet into a formatted space
    > delimited file type, (.PRN). i tried to save it directly using
    >
    > workbooks.save(c:filename.prn), it saves it as prn but not the format that i
    > need, i know that its possible to specify the file type, but i would be
    > really thankfull if some one could help me...thanks


  3. #3
    cher
    Guest

    RE: saving in other File types

    I needed to do the same thing. My spreadsheet was setup as a template but
    you can use any format. Here is what I found to work:

    If Activeworkbook.Fileformat=xltemplate then
    activeworkbook.saveas "O:\Myfolder\Myfile.prn", xlCurrentPlatformText
    EndIf

    If you have a multi-sheet workbook this will rename the sheet you are
    working with. You can always copy the specific worksheet you want to use by
    using:
    Sheets("Sheet3").Copy and then use the save as written above.

    I hope this helps,
    Cheryl

    "Jason" wrote:

    > hi,
    >
    > i am trying to write a code to save an excel sheet into a formatted space
    > delimited file type, (.PRN). i tried to save it directly using
    >
    > workbooks.save(c:filename.prn), it saves it as prn but not the format that i
    > need, i know that its possible to specify the file type, but i would be
    > really thankfull if some one could help me...thanks


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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