473,378 Members | 1,175 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Excel 2000 COM object

I am having a problem with a program that I wrote to format an Excel
spreadsheet. I wrote the program on a WinXP/Office XP/Visual Studio .NET
2003 computer. I am using late-binding. When I try to run the program on a
Win2000/Office 2000 computer, it errs out during runtime. The error shows
that the parameters are incorrect for the Open statement. The problem that
I am having is that many of the Excel 2000 methods seem to take parameters
differently than Excel 2002 methods, even at the most basic level. For
example, this Open statement is what I use when compiling for Excel 2002:

internal object Open( object objBooks, string fileName )
{
object[] Parameters;
Parameters = new Object[15];
Parameters[0] = fileName;
Parameters[1] = Type.Missing;
Parameters[2] = Type.Missing;
Parameters[3] = Type.Missing;
Parameters[4] = Type.Missing;
Parameters[5] = Type.Missing;
Parameters[6] = Type.Missing;
Parameters[7] = Type.Missing;
Parameters[8] = Type.Missing;
Parameters[9] = Type.Missing;
Parameters[10] = Type.Missing;
Parameters[11] = Type.Missing;
Parameters[12] = Type.Missing;
Parameters[13] = Type.Missing;
Parameters[14] = Type.Missing;
return objBooks.GetType().InvokeMember( "Open",
BindingFlags.InvokeMethod, null, objBooks, Parameters );
}

And, after experimentation, here is what I had to use to make it work with
Excel 2000:

internal object Open( object objBooks, string fileName )
{
object[] Parameters;
Parameters = new Object[1];
Parameters[0] = fileName;
return objBooks.GetType().InvokeMember( "Open",
BindingFlags.InvokeMethod, null, objBooks, Parameters );
}

I am also having problems with the Range.Sort method and the Workbook.Close
method. All of these methods run just fine on the Office XP computer, but
they give me "Incorrect number of parameters" errors on the Office 2000
computer.

Has anyone had any experience passing parameters to the Excel COM object. Do
I need to use a different technique?

Thanks,
Dennis
Nov 15 '05 #1
0 1386

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Dean Bortell | last post by:
This code runs fine on win xp and office xp: string sheetPassword = "Senior1993"; string sheetToOpen = "NewRpt1c.xls"; Excel.Application excelApp = new Excel.Application();...
1
by: Benjamin | last post by:
I am making a Windows EXE (.NET Visual Basic Windows Application). I would like to make it possible to open Excel Worksheets from my EXE. This should work independent of Excel version on client...
2
by: Ian | last post by:
I have an Access97 database and I am trying to create an Excel sheet from a report within this database. I have the following code on the On Click event of a button on a form: ...
2
by: David Reynolds | last post by:
Hi Everybody, I have a vb.net webform where I create the Excel application/workbook/worksheet. On Windows 2000 server for some reason, I keep getting an error("Bad variable type") when trying...
1
by: Randall Arnold | last post by:
I'm converting a vbscript program to vb.net. Witht he exception of .net idiosyncrasies, most of it is working well with the same code. My only problem is that some properties and methods are...
2
by: James | last post by:
I am doing some Excel 2000 automaton using Vb 2005. I am referencing the Excel 9.0 COM Object Library. The following code was working fine: Dim xlApp as new Excel.Application Dim xlWb as...
0
by: jostein67 | last post by:
I have moved an ASP application to a new Windows server. Need to export data to Excel. Worked fine before. Not so anymore. Case: - Exporting data from ASP to Excel 2000, using Office Web...
2
by: smtwtfs007 | last post by:
Guys, I am having problems with Excel 2000 to Excel 2003 dll in production. I am having version 2003 in my PC and I used the below code change to open password protected excel files in my...
0
by: smtwtfs007 | last post by:
Guys, I am having problems with Excel 2000 to Excel 2003 dll in production. I am having version 2003 in my PC and I used the below code change to open password protected excel files in my...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.