Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How can I know if Excel supports the fileformat constant?


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

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How can I know if Excel supports the fileformat constant?


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

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default 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" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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" wrote in message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Using FileFormat:=xlText [email protected] Excel Discussion (Misc queries) 0 March 26th 08 04:02 PM
What hyperlink method if any supports target rename? [email protected] Links and Linking in Excel 1 October 4th 07 12:13 PM
Fileformat XLText JeepNC Excel Programming 1 February 14th 05 06:38 PM
Excel 2004 no longer supports SetData appleEvent steveL Excel Programming 0 January 13th 05 08:13 PM
Pocket Excel supports only some functions Jon Grieve Excel Programming 2 December 3rd 03 12:59 PM


All times are GMT +1. The time now is 10:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"