+ Reply to Thread
Results 1 to 8 of 8

How can I know if Excel supports the fileformat constant?

  1. #1
    ExcelReport
    Guest

    How can I know if Excel supports the fileformat constant?

    My Excel version is Excel 2003. I tried the below code, and get a run-time
    error.
    ActiveWorkbook.SaveAs "C:\test.txt", xlTextMSDOS ' Error,
    Err.Number=1004

    I tested some fileformat constants, some are ok and some do not work.
    ActiveWorkbook.SaveAs "C:\test.txt", 21 ' Error,
    Err.Number=1004
    ActiveWorkbook.SaveAs "C:\test.txt", xlCSVMSDOS ' Error,
    Err.Number=1004
    ActiveWorkbook.SaveAs "C:\test.txt", xlCurrentPlatformText 'OK
    ActiveWorkbook.SaveAs "C:\test.txt", xlCSV 'OK

    I donot know why. I guesss the reason is the environment on my computer. My
    question is:
    How can I know if Excel supports the fileformat constant before I use it?


  2. #2
    julie
    Guest

    Re: How can I know if Excel supports the fileformat constant?


    This is interesting, but I think you may not get a good answer back
    because your question isn't specific enough. In general for my
    experience, Excel will work with all the other Microsoft file formats
    on the outcome you want-what specifically are you looking to do? I
    don't know why (maybe this was only in the past too) but you had to
    convert first to csv then to Outlook to work ok but from a
    non-technical perspective in my experience there is always a way to get
    things from Excel to the exact format you want within other Microsoft
    programs-why 2 steps, I'm not sure but are you talking within Microsoft
    programs or in general or what are you looking to do? If you provide
    that info, you will get a more technical response for your solution....


    --
    julie
    ------------------------------------------------------------------------
    julie's Profile: http://www.officehelp.in/member.php?userid=236
    View this thread: http://www.officehelp.in/showthread.php?t=703749
    Visit - http://www.officehelp.in | http://www.officehelp.in/archive/index.php | http://www.officehelp.in/index/index.php


  3. #3
    ExcelReport
    Guest

    Re: How can I know if Excel supports the fileformat constant?

    Juile,

    I tested the below code in my excel, and get a run-time error. I use
    xlCurrentPlatformText and it is OK. Dave Peterson have tested the below code
    in his excel, and it worked fine. I want know the reason, and want to avoid
    error. Is there a way to estimate if it can work before I get a run-time
    error?

    Sub test()
    ActiveWorkbook.SaveAs "C:\test.txt", 21 ' xlTextMSDOS, Error,
    Err.Number=1004
    End Sub

    Best regards!
    Liu Jianzhong


    "julie" wrote:

    >
    > This is interesting, but I think you may not get a good answer back
    > because your question isn't specific enough. In general for my
    > experience, Excel will work with all the other Microsoft file formats
    > on the outcome you want-what specifically are you looking to do? I
    > don't know why (maybe this was only in the past too) but you had to
    > convert first to csv then to Outlook to work ok but from a
    > non-technical perspective in my experience there is always a way to get
    > things from Excel to the exact format you want within other Microsoft
    > programs-why 2 steps, I'm not sure but are you talking within Microsoft
    > programs or in general or what are you looking to do? If you provide
    > that info, you will get a more technical response for your solution....
    >
    >
    > --
    > julie
    > ------------------------------------------------------------------------
    > julie's Profile: http://www.officehelp.in/member.php?userid=236
    > View this thread: http://www.officehelp.in/showthread.php?t=703749
    > Visit - http://www.officehelp.in | http://www.officehelp.in/archive/index.php | http://www.officehelp.in/index/index.php
    >
    >


  4. #4
    julie
    Guest

    Re: How can I know if Excel supports the fileformat constant?


    Liu, this code should work. The only problem I've run into is merged
    cells or other formatting that might easily convert from Excel to txt.
    You could approach the problem for resolution with Dave/a more technical
    person or the only way I could help is what is by knowing more detail or
    the end result you are trying to get the excel file or specific fields
    used for to know a work-around...


    --
    julie
    ------------------------------------------------------------------------
    julie's Profile: http://www.officehelp.in/member.php?userid=236
    View this thread: http://www.officehelp.in/showthread.php?t=703749
    Visit - http://www.officehelp.in | http://www.officehelp.in/archive/index.php | http://www.officehelp.in/index/index.php


  5. #5
    ExcelReport
    Guest

    Re: How can I know if Excel supports the fileformat constant?

    Julie,

    I have a program developed using vba. The program will open an excel
    workbook, and do many works such as putting some data into the workbook. A
    user can select a file name and file type, and save the file. I use
    workbook.saveas, but my excel does not support some constants and get a
    run-time error. If I know what constants excel does not support, then I can
    let user not to select them. But I do not find the way. In this situation, a
    user will get a error message after many processing.

    Best regards!
    Liu Jianzhong

    "julie" wrote:

    >
    > Liu, this code should work. The only problem I've run into is merged
    > cells or other formatting that might easily convert from Excel to txt.
    > You could approach the problem for resolution with Dave/a more technical
    > person or the only way I could help is what is by knowing more detail or
    > the end result you are trying to get the excel file or specific fields
    > used for to know a work-around...
    >
    >
    > --
    > julie
    > ------------------------------------------------------------------------
    > julie's Profile: http://www.officehelp.in/member.php?userid=236
    > View this thread: http://www.officehelp.in/showthread.php?t=703749
    > Visit - http://www.officehelp.in | http://www.officehelp.in/archive/index.php | http://www.officehelp.in/index/index.php
    >
    >


  6. #6
    NickHK
    Guest

    Re: How can I know if Excel supports the fileformat constant?

    Liu Jianzhong,
    I guess you are working on a Chinese system.
    I can confirm your code works fine on English W2K and Office2K, but errors
    on (Traditional) Chinese W2K and Chinese Office.
    Can't tell you why, but I guess you will just have to trap error or use a
    format that you know works in all languages.

    NickHK


    "ExcelReport" <[email protected]> wrote in message
    news:[email protected]...
    > My Excel version is Excel 2003. I tried the below code, and get a run-time
    > error.
    > ActiveWorkbook.SaveAs "C:\test.txt", xlTextMSDOS ' Error,
    > Err.Number=1004
    >
    > I tested some fileformat constants, some are ok and some do not work.
    > ActiveWorkbook.SaveAs "C:\test.txt", 21 ' Error,
    > Err.Number=1004
    > ActiveWorkbook.SaveAs "C:\test.txt", xlCSVMSDOS ' Error,
    > Err.Number=1004
    > ActiveWorkbook.SaveAs "C:\test.txt", xlCurrentPlatformText 'OK
    > ActiveWorkbook.SaveAs "C:\test.txt", xlCSV 'OK
    >
    > I donot know why. I guesss the reason is the environment on my computer.

    My
    > question is:
    > How can I know if Excel supports the fileformat constant before I use it?
    >




  7. #7
    Dave Peterson
    Guest

    Re: How can I know if Excel supports the fileformat constant?

    Ahhhhhhhh...

    That would explain why I didn't have any problems!

    NickHK wrote:
    >
    > Liu Jianzhong,
    > I guess you are working on a Chinese system.
    > I can confirm your code works fine on English W2K and Office2K, but errors
    > on (Traditional) Chinese W2K and Chinese Office.
    > Can't tell you why, but I guess you will just have to trap error or use a
    > format that you know works in all languages.
    >
    > NickHK
    >
    > "ExcelReport" <[email protected]> wrote in message
    > news:[email protected]...
    > > My Excel version is Excel 2003. I tried the below code, and get a run-time
    > > error.
    > > ActiveWorkbook.SaveAs "C:\test.txt", xlTextMSDOS ' Error,
    > > Err.Number=1004
    > >
    > > I tested some fileformat constants, some are ok and some do not work.
    > > ActiveWorkbook.SaveAs "C:\test.txt", 21 ' Error,
    > > Err.Number=1004
    > > ActiveWorkbook.SaveAs "C:\test.txt", xlCSVMSDOS ' Error,
    > > Err.Number=1004
    > > ActiveWorkbook.SaveAs "C:\test.txt", xlCurrentPlatformText 'OK
    > > ActiveWorkbook.SaveAs "C:\test.txt", xlCSV 'OK
    > >
    > > I donot know why. I guesss the reason is the environment on my computer.

    > My
    > > question is:
    > > How can I know if Excel supports the fileformat constant before I use it?
    > >


    --

    Dave Peterson

  8. #8
    ExcelReport
    Guest

    Re: How can I know if Excel supports the fileformat constant?

    Yes, I am working on a Simple Chinese system. OS is Windows XP Professional,
    and Excel version is Microsoft Office Excel 2003 Professional Edition.

    Thanks!
    Liu Jianzhong


    "NickHK" wrote:

    > Liu Jianzhong,
    > I guess you are working on a Chinese system.
    > I can confirm your code works fine on English W2K and Office2K, but errors
    > on (Traditional) Chinese W2K and Chinese Office.
    > Can't tell you why, but I guess you will just have to trap error or use a
    > format that you know works in all languages.
    >
    > NickHK
    >
    >
    > "ExcelReport" <[email protected]> wrote in message
    > news:[email protected]...
    > > My Excel version is Excel 2003. I tried the below code, and get a run-time
    > > error.
    > > ActiveWorkbook.SaveAs "C:\test.txt", xlTextMSDOS ' Error,
    > > Err.Number=1004
    > >
    > > I tested some fileformat constants, some are ok and some do not work.
    > > ActiveWorkbook.SaveAs "C:\test.txt", 21 ' Error,
    > > Err.Number=1004
    > > ActiveWorkbook.SaveAs "C:\test.txt", xlCSVMSDOS ' Error,
    > > Err.Number=1004
    > > ActiveWorkbook.SaveAs "C:\test.txt", xlCurrentPlatformText 'OK
    > > ActiveWorkbook.SaveAs "C:\test.txt", xlCSV 'OK
    > >
    > > I donot know why. I guesss the reason is the environment on my computer.

    > My
    > > question is:
    > > How can I know if Excel supports the fileformat constant before I use it?
    > >

    >
    >
    >


+ 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