Array in Worksheet Functions STDEV (Excel in C++)

Discussion in 'C++' started by CPPLearner, Feb 12, 2010.

  1. CPPLearner

    CPPLearner New Member

    Joined:
    Feb 12, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    I have been pretty successful in understanding the implementation of drawing charts in and exporting data to excel. Now I am trying to implement Excel Worksheet functions in C++. Here is the working structure of it:

    double wf = xl->Application->WorksheetFunction->STDEV(1,2,3,4,5);
    cout<<wf;

    However, I have not been successful in passing an array or vector of doubles to STDEV. E.g. If I have an array: arr[5] = {1,2,3,4,5};
    How do I implement:

    double wf2 = xl->Application->WorksheetFunction->STDEV(arr);
    cout<<wf2;

    The kind of errors that I am getting currently relates to passing of the data type into STDEV. Is there a way to convert my arr to const _variant_t type? As this is the type which is being accepted as argument to function STDEV.

    Any leads?
     
  2. Gene Poole

    Gene Poole New Member

    Joined:
    Nov 10, 2009
    Messages:
    93
    Likes Received:
    5
    Trophy Points:
    0

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice