+ Reply to Thread
Results 1 to 8 of 8

The parameter is incorrect

  1. #1
    overcanyon
    Guest

    The parameter is incorrect

    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?


  2. #2
    Jim Cone
    Guest

    Re: The parameter is incorrect

    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



    "overcanyon" <mjoyce@storm.ie> wrote in message
    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?


  3. #3
    overcanyon
    Guest

    Re: The parameter is incorrect

    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


  4. #4
    Tom Ogilvy
    Guest

    Re: The parameter is incorrect

    If the primary interop assembly is not installed in the global assembly
    cache, Visual Studio generates an interop assembly for the project that
    might not work fully in all cases. For more information, see Troubleshooting
    in Office at Run Time.

    http://msdn2.microsoft.com/library/6s0wczt9.aspx

    --

    Regards,

    Tom Ogilvy



    "overcanyon" <mjoyce@storm.ie> wrote in message
    news:1138719878.615212.278990@g14g2000cwa.googlegroups.com...
    > 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
    >




  5. #5
    Jim Cone
    Guest

    Re: The parameter is incorrect

    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


    "overcanyon" <mjoyce@storm.ie> wrote in message news:1138719878.615212.278990@g14g2000cwa.googlegroups.com...
    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


  6. #6
    overcanyon
    Guest

    Re: The parameter is incorrect

    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.

    Tom Ogilvy wrote:

    > If the primary interop assembly is not installed in the global assembly
    > cache, Visual Studio generates an interop assembly for the project that
    > might not work fully in all cases. For more information, see Troubleshooting
    > in Office at Run Time.
    >
    > http://msdn2.microsoft.com/library/6s0wczt9.aspx
    >
    > --
    >
    > Regards,
    >
    > Tom Ogilvy
    >
    >
    >
    > "overcanyon" <mjoyce@storm.ie> wrote in message
    > news:1138719878.615212.278990@g14g2000cwa.googlegroups.com...
    > > 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
    > >



  7. #7
    overcanyon
    Guest

    Re: The parameter is incorrect

    Jim, my code is VB.NET so I don't think Set is an issue.


  8. #8
    Tom Ogilvy
    Guest

    Re: The parameter is incorrect

    I code without a .NET, so I can't tell you.
    Look at this link:
    http://www.*****-blog.com/archives/2...rt-classic-vb/

    Stephen Bullen is the author. In the responses, look at item #8 also
    written by Stephen.

    This may give you a clearer picture:

    http://msdn.microsoft.com/office/arc...ych2_part1.asp

    --
    Regards,
    Tom Ogilvy



    "overcanyon" <mjoyce@storm.ie> wrote in message
    news:1138724111.222134.12660@g44g2000cwa.googlegroups.com...
    > 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.
    >
    > Tom Ogilvy wrote:
    >
    > > If the primary interop assembly is not installed in the global assembly
    > > cache, Visual Studio generates an interop assembly for the project that
    > > might not work fully in all cases. For more information, see

    Troubleshooting
    > > in Office at Run Time.
    > >
    > > http://msdn2.microsoft.com/library/6s0wczt9.aspx
    > >
    > > --
    > >
    > > Regards,
    > >
    > > Tom Ogilvy
    > >
    > >
    > >
    > > "overcanyon" <mjoyce@storm.ie> wrote in message
    > > news:1138719878.615212.278990@g14g2000cwa.googlegroups.com...
    > > > 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
    > > >

    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1