Bonjour a tous,

J'aimerai faire appel a une de mes fonctions C# lorsque je rentre une formule dans une cellule, pour ceci j'ai suivi le tutorial de Gabhan Berry, mais il ne fonctionne pas chez moi car la fonction n'est pas reconnu, en revanche il n'y a aucun probleme de compilation.

Voici le code :

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
 
[assembly: ComVisible(true)]
namespace ExcelAddIn {
    interface ICellFunctions {
        String dnaGetBlock(String blockName);
    }
 
    [ComDefaultInterface(typeof(ICellFunctions))]
    public class CellFunctions : ICellFunctions {
        [ComRegisterFunctionAttribute]
        public static void RegisterFunction(Type type) {
            Registry.ClassesRoot.CreateSubKey(GetSubKeyName(type));
        }
 
        [ComUnregisterFunctionAttribute]
        public static void UnregisterFunction(Type type) {
            Registry.ClassesRoot.DeleteSubKey(GetSubKeyName(type), false);
        }
 
        private static string GetSubKeyName(Type type) {
            string s = @"CLSID\{" + type.GUID.ToString().ToUpper() + @"}\Programmable";
            return s;
        }
 
        public String dnaGetBlock(String blockName) {
            MessageBox.Show("block");
            return "";
        }
    }
}
Voila je repete que j'ai cree un addin excel 2003 et que j'utilise VSTO 2005.

Merci