Bonjour,
J'ai créé une xll avec visual c++ 2008 (pour appeler des fonctions dans excel 2007). Quand je compile tout se passe bien , mais le problème est que mes fonctions n'apparaissent pas dans excel. Voici le code:
dans un fichier UDF.cpp
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54 #include <windows.h> #include <xlcall.h> #include <framewrk.h> #include <stdio.h> #include <math.h> #include<iostream> //programme ayant pour but d'interpoler en un point x , et avec deux tableaux __declspec(dllexport) xloper* interp(double x, FP *yy,FP *xx, int dont_extrapolate) { if(yy->columns !=xx->columns ||yy->rows !=xx->rows) return p_xlErrValue; int low=0,high, i; static xloper ret_val={0.0,xltypeNum}; if (yy->rows==1) high=yy->columns-1; else if (yy->columns==1) high=yy->rows-1; else return p_xlErrValue; if (high==0) { ret_val.val.num=yy->array[0]; return &ret_val; } if(x<xx->array[0] || x>xx->array[high]) { if(dont_extrapolate) return p_xlErrNum; ret_val.val.num=yy->array[x<xx->array[0] ? 0: high]; return &ret_val; } while(high-low>1) { i=(high+low)>>1; if(xx->array[i]>x) high=i; else low=i; } ret_val.val.num=yy->array[low]+(x-xx->array[low])*(yy->array[high]-yy->array[low]) /(xx->array[high]-xx->array[low]); return &ret_val; }
la signature est "RBKKI"
Partager