The quest for the Excel custom function tooltip

前端 未结 3 1387
别跟我提以往
别跟我提以往 2020-11-28 18:50

This question has been asked before, but each time the accepted answer is simply a resignation to provide function descriptions using Application.MacroOptions (

相关标签:
3条回答
  • 2020-11-28 19:33

    How about

    1. Capture inputting text on key press event of cell. like this
    2. Check if the text matches with custom functions.
    3. If matches, then show something like label or shape to pretend be a tooltip. like this

    Is this acceptable?

    It is a little ugly but easier.

    0 讨论(0)
  • 2020-11-28 19:34

    I've posted a proof-of-concept project to GitHub as the Excel-DNA IntelliSense project, implementing this.

    Using the UI Automation classes to monitor the appropriate Excel user interface events, a form is displayed when appropriate.

    The code is wrapped as an Excel-DNA add-in, and works on my Excel 2013 / Windows 8 machine. I've tested on one other configuration (64-bit Excel 2010 on Windows Server 2008) and had a serious problems.

    For a C# function defined with the Excel-DNA attributes like this:

    [ExcelFunction(Description = 
        "A useful test function that adds two numbers, and returns the sum.")]
    public static double AddThem(
        [ExcelArgument(Name = "Augend", 
                       Description = "is the first number, to which will be added")] 
        double v1,
        [ExcelArgument(Name = "Addend", 
                       Description = "is the second number that will be added")]     
        double v2)
    {
        return v1 + v2;
    }
    

    we get both the function description

    Function Description

    and when selecting the function, we get argument help

    Argument Help

    That looks nice, but it's all still very flaky, only works on my machine and sometimes crashes Excel. It might be a start, though...


    Update 9 May 2014:

    I've made some progress figuring out how to make the argument help work under older Excel and Windows versions. However, it still needs quite a lot of work to get everything reliable. Anyone who would like to help with this should please contact me directly.


    Update 18 June 2016:

    Excel UDF IntelliSense support for both Excel-DNA add-ins and VBA functions is now being tested. See the Getting Started page on GitHub for instructions.

    0 讨论(0)
  • 2020-11-28 19:34

    What is XLL?

    An XLL is a DLL that exports several procedures that are called by Excel or the Excel Add-in Manager. http://msdn.microsoft.com/en-us/library/office/bb687861.aspx

    How you develop the XLL?

    Excel XLL SDK with Visual C++ (or anything that can compile a DLL and call the SDK procedures)

    Where I can find a quick guide for creating a simple XLL?

    http://support.microsoft.com/kb/178474

    How I get tooltips?

    1. Implement your function as a procedure and export it
    2. Implement and export procedure xlAutoOpen(void) - http://msdn.microsoft.com/en-us/library/office/bb687860.aspx
    3. xlAutoOpen just needs to call xlfRegister - http://msdn.microsoft.com/en-us/library/office/bb687900.aspx
    4. For tooltips, special attention for: pxArgumentText, pxFunctionHelp, pxArgumentHelp1

    Sadly, the Analysis Toolpak add-in doesn't have tooltips either.

    My solution was wrong, but with wrong information posted by the original poster. Showing a picture with BINOMDIST, if his link clearly shows that this is not a function of ANALYS32.xll.

    This means I was trying to solve an impossible question. Because there is no XLL that can do what the poster requested. If you find a version of Excel that show tooltips of XLLs, please let me know.

    About what the poster asked, trying to mimic the XLL behavior, I am sure my answer was the most correct in relation of what ANALYS32.xll do.

    0 讨论(0)
提交回复
热议问题