The parameter is incorrect

O

overcanyon

Hi folks,

I have an application that generates spreadsheets. It is developed in
VB.NET 2003 and works well on XP with Excel 2003. Have tried to deploy
this on Windows Server 2000 with Excel 2000 only to get an error 'The
parameter is incorrect'. This error occurs on the follwing line:

ourPivotCache =
xlApp.ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase,
SourceData:=rngData)

I don't think there is anything wrong with this line, bear in mind this
app works perfectly on XP against Excel 2003.

Now.. in an effort to fix this problem, I went and built this app on
the Windows 2000 server with VS .NET 2003 having changed the reference
to the Excel 9 library. Still no luck.

One thing worth noting here is that if I invoke Excel 2000 manually, a
message box appears with 'Cannot use object linking and embedding'. Is
this something to do with the problem, I don't know.

Anyone any ideas?
 
J

Jim Cone

o,

This is just a guess.

Try replacing the Excel constant "xlDatabase" with its numeric value...
SourceType:=1
or
Try qualifying the constant with the application object...
SourceType:=xlApp.xlDatabase

Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



Hi folks,
I have an application that generates spreadsheets. It is developed in
VB.NET 2003 and works well on XP with Excel 2003. Have tried to deploy
this on Windows Server 2000 with Excel 2000 only to get an error 'The
parameter is incorrect'. This error occurs on the follwing line:

ourPivotCache =
xlApp.ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase,
SourceData:=rngData)

I don't think there is anything wrong with this line, bear in mind this
app works perfectly on XP against Excel 2003.
Now.. in an effort to fix this problem, I went and built this app on
the Windows 2000 server with VS .NET 2003 having changed the reference
to the Excel 9 library. Still no luck.
One thing worth noting here is that if I invoke Excel 2000 manually, a
message box appears with 'Cannot use object linking and embedding'. Is
this something to do with the problem, I don't know.
Anyone any ideas?
 
O

overcanyon

Thanks for the reply Jim.

Fact is I've tried that. If any of the parameters is the problem it may
be the second one. I did revert to hard coding a range in here to see
what would happen and the line runs ok... but that's not the point
really... the app still falls over later on. So I think this is a red
herring and there is something more sinister or fundamental going on
here. For what it's worth, the preceeding line is:

rngData = xlApp.ActiveWorkbook.Sheets("Raw Data Sheet").UsedRange
'rngData having been declared as Excel.Range
 
J

Jim Cone

o,

As I understand it, VB.net does not use "Set" statements.
However, you code appears to be VBA?
If so, you must first declare the variable and then define it by
using the Set statement...
Set rngData = xlApp...

Jim Cone
San Francisco, USA


Thanks for the reply Jim.

Fact is I've tried that. If any of the parameters is the problem it may
be the second one. I did revert to hard coding a range in here to see
what would happen and the line runs ok... but that's not the point
really... the app still falls over later on. So I think this is a red
herring and there is something more sinister or fundamental going on
here. For what it's worth, the preceeding line is:

rngData = xlApp.ActiveWorkbook.Sheets("Raw Data Sheet").UsedRange
'rngData having been declared as Excel.Range
 
O

overcanyon

Tom, I have looked at the link you suggested. The instructions for
installing the primary interop assembly (and the article in general)
appears to be aimed at Excel 2003. (I tried but was not given the
option for .NET Programmability Support)

Are primary interop assemblies available for Excel 2000? I've seen much
reference to PIAs but this always seem to refer to later (than 2000)
versions of Excel. Is there a separate remedy for this version?

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top