none
64 bit Excel 2016, F4 and xlcOnRecalc RRS feed

  • Question


  • I have a strange effect with F4 using 64 bit Excel 2016.

    In my test worksheet I have

    A1: =RAND()
    A3: 1
    B3: 2
    A4: a
    B4: b
    C4: c

    With no addin loaded:

    I select row 3 and delete it.
    then the row with a b c comes row 3.
    Then I press F4.
    Threfore also the row with a bc is gone.

    That's expected behaviour.

    Now an Addin register a XLL.

    And this register register via xlcOnRecalc a recalculation handler.
    This handler looks very simplified

    _declspec(dllexport) LPXLOPER12 my_recalc_handler() {
    	return TempBool(1);
    }

    It is registered with "U" and as command (2).

    Now I try the same as above.
    But when I now press F4 (after deleting row 3) nothing happnes
    (at least not visible)

    The row with a b c remains
    (and the value in A1 hasn't changed).

    Is there a trick to get F4 working also with a recalculation handler ?

    tia

      Hendrik Schmieder


    Friday, August 11, 2017 1:44 PM

All replies

  • Hi Hendrik,

    Thank you for posting in the MSDN Forum.

    I'm trying to involve some senior engineers into this issue and it will take some time. Your patience will be greatly appreciated.

    Sorry for any inconvenience and have a nice day! 

    Best Regards,

    Terry


    Monday, August 14, 2017 8:09 AM
  • More Information.

    the calback function I use as recalc handler Looks (very simplified ) as this

    _declspec(dllexport) int _stdcall my_recalc() {
    	return 1;
    }
    


    This is the code I use  to rgister and set the recalchandler

    int rc;
    XLOPER12 xMissing, xType, xId, xName, xResult;
    LPXLOPER12 xRecalc;
    LPXLOPER12 xArgs[6];
    
    xMissing.xltype = xltypeMissing;
    xType.xltype = xltypeInt;
    xType.val.w = 2;
    
    xRecalc = TempStr("MY_RECALC_HANDLER", nullptr, 0);
    
    rc = Excel12(xlGetName, &xName, 0);
    
    xArgs[0] = &xName; 
    xArgs[1] = TempStr("my_recalc", nullptr, 1);
    xArgs[2] = TempStr("J", nullptr, 1);
    xArgs[3] = xRecalc;
    xArgs[4] = &xMissing;
    xArgs[5] = &xType;
    
    rc = Excel12v(xlfRegister, &xId, 6, xArgs);
    
    rc = Excel12(xlcOnRecalc, &xResult, 2, &xMissing, xRecalc);

    TempStr is  a lokal function which returns a string LPXLOPER12.

     If I comment out the line with xlcOnRecalc, then F4 works.

    with best regards

      Hendrik Schmieder

     

    Monday, October 9, 2017 12:20 PM
  • Hello Mr. Xu,

    is there something new on this issue ?

    What is the official way to open a bug Report for Excel ?

    tia

      Hendrik Schmieder

     

    Tuesday, December 5, 2017 2:41 PM
  • F4 (repeat last action) can 'forget' what the last action was for various reasons, some obvious like clearing the undo stack, lost with most actions with code that change the UI. So if your handler changes something that'll be why, though there might be other reasons.

    F4 became a lot more 'forgetful' in 2007, several have complained about it over the years. Feel free to report it as a bug but best not to expect a quick fix:)

    Tuesday, December 5, 2017 5:09 PM
    Moderator
  • Hello Mr. Thornton,

    it is clear that F4 wont work if we do something which clears the undo stack,

    But F4 even doesn't work with the simplest recalc handle like this

    _declspec(dllexport) int _stdcall my_recalc() {
    	return 1;
    }

    This do effective nothing, but if I Register this as recalc handler F4 doesn't work anymore,

    Bugreporting:

    Although we have several Enterprise MSDN accounts, we dosen't know how to open an Excel bug Report,

    since we dosen't know the appropriate URL for this.

    regards

      Hendrik Schmieder

    Wednesday, December 6, 2017 1:26 PM
  • Yes I know, as I tried to explain F4 became much more forgetful in 2007, not only when the undo stack is cleared. 

    It's been reported by MVPs and no doubt others but worth reporting again -

    https://excel.uservoice.com/

    Thursday, December 7, 2017 7:35 AM
    Moderator