Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default SaveAs in Excel97-2003 format

I am working in Excel 2000 on a machine which also has Excel 2007 installed.

In a macro this line is causing Excel to crash:

bk.SaveAs Filename:=excel_output_file, FileFormat:=xlNormal

bk is a workbook and excel_output_file is a string ending with .xls

Is there a problem with the xlNormal value? Is there a value which will
specify Excel 97-2003 format which would work? (Because I opened the workbook
from a .csv file if I leave out the FileFormat parameter it saves in csv
format which I don't want.)

Grateful for advice.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default SaveAs in Excel97-2003 format

That should work fine in all versions. Are you sure excel_output_file is
valid (apart from the .xls). What error are you getting.

FWIW, I know xlNormal is what you get from the macro recorder, a bit sloppy
as it should really be xlWorkbookNormal. Not that it should make any
difference as both constants should refer to -4143. But talking of
constants, be sure not to include any of the new XL2007 named constants if
working in XL2000, even if not actually calling them in XL2000. If catering
for different versions change them to their intrinsic values.

Regards,
Peter T

"simonc" wrote in message
...
I am working in Excel 2000 on a machine which also has Excel 2007
installed.

In a macro this line is causing Excel to crash:

bk.SaveAs Filename:=excel_output_file, FileFormat:=xlNormal

bk is a workbook and excel_output_file is a string ending with .xls

Is there a problem with the xlNormal value? Is there a value which will
specify Excel 97-2003 format which would work? (Because I opened the
workbook
from a .csv file if I leave out the FileFormat parameter it saves in csv
format which I don't want.)

Grateful for advice.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default SaveAs in Excel97-2003 format

Thanks for your response. It's hard to say what the error is because it
generates one of those windows that says "Microsoft Excel for Windows has
encountered a problem and needs to close". Annoyingly it leaves an excel
process running, so you have to kill that with Task Manager.

excel_output_file is definitely a valid filename.

However, the problem may be that it can't overwrite the existing file,
because when I deleted the existing output .xls file the macro ran without an
error. There doesn't seem to be an option in SaveAs to overwrite the existing
file. How can you get it to put up a dialogue box to ask if you want to?

"Peter T" wrote:

That should work fine in all versions. Are you sure excel_output_file is
valid (apart from the .xls). What error are you getting.

FWIW, I know xlNormal is what you get from the macro recorder, a bit sloppy
as it should really be xlWorkbookNormal. Not that it should make any
difference as both constants should refer to -4143. But talking of
constants, be sure not to include any of the new XL2007 named constants if
working in XL2000, even if not actually calling them in XL2000. If catering
for different versions change them to their intrinsic values.

Regards,
Peter T

"simonc" wrote in message
...
I am working in Excel 2000 on a machine which also has Excel 2007
installed.

In a macro this line is causing Excel to crash:

bk.SaveAs Filename:=excel_output_file, FileFormat:=xlNormal

bk is a workbook and excel_output_file is a string ending with .xls

Is there a problem with the xlNormal value? Is there a value which will
specify Excel 97-2003 format which would work? (Because I opened the
workbook
from a .csv file if I leave out the FileFormat parameter it saves in csv
format which I don't want.)

Grateful for advice.




.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default SaveAs in Excel97-2003 format

This should help you.

http://www.rondebruin.nl/saveas.htm
--
HTH,

Barb Reinhardt



"simonc" wrote:

I am working in Excel 2000 on a machine which also has Excel 2007 installed.

In a macro this line is causing Excel to crash:

bk.SaveAs Filename:=excel_output_file, FileFormat:=xlNormal

bk is a workbook and excel_output_file is a string ending with .xls

Is there a problem with the xlNormal value? Is there a value which will
specify Excel 97-2003 format which would work? (Because I opened the workbook
from a .csv file if I leave out the FileFormat parameter it saves in csv
format which I don't want.)

Grateful for advice.


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
SaveAs in xlNormal Format BEEJAY Excel Programming 2 November 14th 07 09:02 PM
Invoice templet Excel97 to 2003 invoice toolbar missing MarolynInMarion Excel Discussion (Misc queries) 0 August 19th 05 07:15 PM
Excel 2003 pivot table has less functionnalities than in Excel97 blandineb64 Excel Discussion (Misc queries) 1 June 17th 05 10:59 AM
Compatibility issue? Excel97/2003 HBj[_3_] Excel Programming 4 January 3rd 05 09:15 PM
VBA - SaveAs hangs (2003 vs 2k ?) mtrak Excel Programming 2 June 7th 04 06:08 PM


All times are GMT +1. The time now is 05:01 PM.

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

About Us

"It's about Microsoft Excel"