ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel workbook.saveas freezes program (https://www.excelbanter.com/excel-programming/367701-excel-workbook-saveas-freezes-program.html)

Ryan[_12_]

Excel workbook.saveas freezes program
 
In C# I create and open an excel spreadsheet, populate it with data,
and then attempt to save it. This all works fine on my XP SP2 machine
with Excel 2003. However when I try to run it on Windows 2000 with
Excel 2000, the code gets stuck on _wb.Saveas (see code snippet below).

_app = new Excel.Application();
_wb = _app.Workbooks.Add(Type.Missing);
_ws = (Excel._Worksheet) _wb.Sheets.get_Item(1);

//populate the worksheet with data

_wb.SaveAs(aFileName, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing,
Excel.XlSaveAsAccessMode.xlNoChange,Type.Missing, Type.Missing,
Type.Missing, Type.Missing,Type.Missing);

Thanks,
Ryan


NickHK

Excel workbook.saveas freezes program
 
Ryan,
Excel 2K only has 10 arguments to .SaveAs., but it appears Excel 2003 has
12.
You should make your code compatible with the oldest version you intend to
support.

NickHK

"Ryan" wrote in message
oups.com...
In C# I create and open an excel spreadsheet, populate it with data,
and then attempt to save it. This all works fine on my XP SP2 machine
with Excel 2003. However when I try to run it on Windows 2000 with
Excel 2000, the code gets stuck on _wb.Saveas (see code snippet below).

_app = new Excel.Application();
_wb = _app.Workbooks.Add(Type.Missing);
_ws = (Excel._Worksheet) _wb.Sheets.get_Item(1);

//populate the worksheet with data

_wb.SaveAs(aFileName, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing,
Excel.XlSaveAsAccessMode.xlNoChange,Type.Missing, Type.Missing,
Type.Missing, Type.Missing,Type.Missing);

Thanks,
Ryan




Ryan[_12_]

Excel workbook.saveas freezes program
 
Sorry this issue got sidetracked.

Thanks alot, that is the problem.

Do you know if there's somewhere that I can find documentation about
the differences between the versions of office from a programmer's
perspective?

Thanks.

NickHK wrote:
Ryan,
Excel 2K only has 10 arguments to .SaveAs., but it appears Excel 2003 has
12.
You should make your code compatible with the oldest version you intend to
support.

NickHK

"Ryan" wrote in message
oups.com...
In C# I create and open an excel spreadsheet, populate it with data,
and then attempt to save it. This all works fine on my XP SP2 machine
with Excel 2003. However when I try to run it on Windows 2000 with
Excel 2000, the code gets stuck on _wb.Saveas (see code snippet below).

_app = new Excel.Application();
_wb = _app.Workbooks.Add(Type.Missing);
_ws = (Excel._Worksheet) _wb.Sheets.get_Item(1);

//populate the worksheet with data

_wb.SaveAs(aFileName, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing,
Excel.XlSaveAsAccessMode.xlNoChange,Type.Missing, Type.Missing,
Type.Missing, Type.Missing,Type.Missing);

Thanks,
Ryan




All times are GMT +1. The time now is 08:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com