Menu

#11 Function in 2007 not appearing in list

open
nobody
None
3
2009-06-21
2009-04-14
Carl Smith
No

Hello,
Firstly I would like to say a big thankyou to the creators of XLW and making it available to simpletons like me.

I should state that I am not a programmer and have only got as far as I have with sheer stuborness so any eventual replies need to fairly simplified.
I am using Visual C++ 2005 Express Edition and the xlw example project which has this version "// $Id: xlwExample.cpp,v 1.12 2003/03/08 22:21:02 jlecomte Exp $" in the xlwexample.cpp

All I have done is add some of my own functions to the "handwritten" example all of which work fine in excel 2003 but one function does not work in excel 2007, that is, it does not appear in the function list.

Here is my function below that does not work (appear) in excel 2007 but fine in excel 2003, many thanks in advance for any eventual replies

// Register the function PT100.

XLRegistration::Arg PT100Args[] = {
{ "Voltage", "voltage", "XLF_OPER" },
{ "Channel fudge", "chnlfdgeconst", "XLF_OPER" },
{ "Intercept fudge", "chnlintcpt", "XLF_OPER" }
};

XLRegistration::XLFunctionRegistrationHelper registerPT100(
"xlPT100", "PT100", "Compute the temperature Value from voltage "
"loaded 18/01/2009",
"CarlitoBFuncs", PT100Args, 3);

LPXLFOPER EXCEL_EXPORT xlPT100(XlfOper xlVolt, XlfOper xlChnlfdgeConst,XlfOper xlChnlIntcpt){
EXCEL_BEGIN;
const double Ro = 100;
const double A1 = -0.000000580195;
const double B1 = 0.00390802;
double a,b,c,dRT, pt100;
double fvolt = xlVolt.AsDouble();
double chnlfdgeConst = xlChnlfdgeConst.AsDouble();
double chnlIntcpt = xlChnlIntcpt.AsDouble();

a = Ro * A1;
b = Ro * B1;
dRT = (fvolt + chnlIntcpt) * chnlfdgeConst;
c = -dRT;
if(b*b-4*a*c<0)pt100=-50;
else
pt100 = (-b + sqrt(b*b-4*a*c))/(2*a);

return XlfOper(pt100);
EXCEL_END;

}

Discussion

  • Narinder Claire

    Narinder Claire - 2009-06-21

    Idealy the xlwExample way of writing xlls should be used for legacy code. In the newer versions of xlw there is no need to deal with the LPXLFOPER types explicitly.

    Have you tried the Beta of xlw4 ( xlw4.0.0b0 ) ?

    If you still prefer do things the old way please let us know which version xlw you are using. Support for 2007 was only added in xlw3 by Eric Ehlers.

     
  • Narinder Claire

    Narinder Claire - 2009-06-21
    • priority: 5 --> 3