xlfevaluate and several workbook RRS feed

  • Question

  • Hello,

    I have an UDf mytest() in Xll which uses xlfevaluate to get the value for a named range.

    If the workbbok wb1.xls containing mytest() is the active workbook this works.

    Now when a second workbook wb2 is opened then wb1 isn't the active workbook anymore and xlfevaluate fails.

    I tried to use

    LPXLOPER12 ws = GetWorkSheet(sheetid);
    XLOPER12 result;
    if (ws != NULL) {
    	int rc = Excel12(xlcWorkbookActivate, &xResult, 1, ws);


    LPXLOPER12 ws = GetWorkSheet(sheetid);
    XLOPER12 result, replace;
    replace.xltype = xltypeBool;
    replace.val.xbool = 1;;
    if (ws != nullptr) {
    	int rc = Excel12(xlcWorkbookSelect, &xResult, 3, ws, ws, &replace);

    ws is always not null and pointing to string Xloper12 with correct worksheetname of form [wb1.xlsx]sheet1 and

    rc is always xlretSuccess, but xResult is a bool Xloper12 with xbool = 0.

    xlSheetId does return the  same shhetid as before calling xlcWorkbookActivate resp xlcWorkbookSelect,

    so it Looks like active workbook hasn't changed.

    So how I can get mytest()  working if the active workbook is not the one containg the cell with mytest()  formula ?


      Hendrik Schmieder


    Tuesday, January 20, 2015 10:54 AM

All replies

  • Hi h_schmieder,

    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!
    Regards & Fei

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, January 22, 2015 1:47 AM
  • Hi h_schmieder,

    Sorry for delayed response.

    I would like to know if GetWorkSheet method is your custom defined method. Also, it would be helpful if you could share me a scaled down repro solution where I can repro in house and investigate further.


    Thursday, March 19, 2015 7:06 PM
  • I solved my xlfEvalute Problem by using

    [21920_6.xlsx]Sheet1!pick as argument to xlfEvalute instead of just !pick or pick.

      Hendrik Schmieder


    Thursday, March 26, 2015 9:57 AM