1

I'm using the Xlw framework which provides convenient wrappers for writing C++ add-ins in Excel. I've come across a problem: when I name an Excel function for use in Excel with a digit on the end, the function is not 'exposed' (ie. loaded by the add-in) in Excel. When I remove the last digit, or include digits in the function name but finish the function with a non-digit, it appears just fine.

AddTwo(double x) // available in Excel
Add123Two(double x) // available in Excel
Add2(double x)   // not available in Excel

(C++ Excel add-ins are simply .dlls renamed to .xll with a few other specifics in the .dll contents).

I haven't seen any relevant Microsoft naming restrictions for exported .dll functions, but my question is: is it OK to create an exported .dll function that has digits as its last characters? If so, I guess the problem is Excel or Xlw framework related.

Pete855217
  • 1,570
  • 5
  • 23
  • 35
  • 'Add2' is a valid cell address, maybe that is the reason why it doesn't work. If you call VBA function like that, excel won't allow to use it as UDF. – BrakNicku Apr 06 '16 at 12:00
  • Thanks BrakNicku - I think you're onto it...will test it and update...good spot! Pete – Pete855217 Apr 06 '16 at 12:04
  • Checked it BrakNicku2 - you're correct. Using another name with digits at the end (called NewFunction2) works fine. Excel does indeed have a column ADD (and row 2 for this column). I had no idea Excel columns went up that high! Thanks again. (If you make your response an answer, I'll accept it if you like). Pete – Pete855217 Apr 06 '16 at 12:26

1 Answers1

1

You can't call a function (used as UDF) with a name which is an address of a cell (A1-XFD1048576). The same rule applies to named ranges.

BrakNicku
  • 5,935
  • 3
  • 24
  • 38