UDF Method never entered if format for cell set to Text

Dec 5, 2013 at 8:01 PM

I have a UDF that runs fine when the format is set to General. When the format is set to Text, the function is never entered. The declaration is provided below.

Any ideas?
        [ExcelFunction(Description = "Data Service",Category="MyCategory")]
        public static object MyUDF([ExcelArgument(Name = "Param1", Description = "Parameter 1")]string szParam1,
                                    [ExcelArgument(Name = "Param2", Description = "Parameter 2")]string szParam2,
                                    [ExcelArgument(Name = "Param3", Description = "Parameter 3")]string szParam3,
                                    [ExcelArgument(Name = "Param4", Description = "Parameter 4")]string szParam4)
Dec 5, 2013 at 8:08 PM
Hi Lee,

Setting the format to Text will make Excel interpret your formula as a literal string, and not evaluate the formula. It's similar to using ' in front of the formula.
You'll get the same with a formula like =1+2.

Dec 5, 2013 at 8:09 PM
Thanks a bunch Govert!