Behaviour of IsInFunctionWizard within range

Add-in Express™ Support Service
That's what is more important than anything else

Behaviour of IsInFunctionWizard within range
ADXXLLModule.IsInFunctionWizard returns true when range of cells selected 
Rob Sullivan




Posts: 42
Joined: 2011-09-01
Hi there,

It seems that the ADXXLLModule.IsInFunctionWizard returns True when searching and replacing text within formulas.

Our users are used to being able to have many cells with FacacdeFunctions defined and to trigger a recalculation of multiple cells, selecting a range, and doing a replace (Ctrl-H) with value "=" to "=".

However none of the cells are recalculated as IsInFunctionWizard always returns true.

Is there a way you know of being able to provide the above functionality?

Many thanks in advance,

Rob
Posted 08 Nov, 2011 09:49:26 Top
Andrei Smolin


Add-in Express team


Posts: 17239
Joined: 2006-05-11
Hello,

Rob Sullivan writes:
Is there a way you know of being able to provide the above functionality?


A brief research showed that we can probably add this feature in an upcoming build. For you refeernce, the case number is #3336.

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 09 Nov, 2011 05:06:43 Top
Rob Sullivan




Posts: 42
Joined: 2011-09-01
Andrei,

Thanks for getting back to me,

I'll keep an eye on future builds to see if that feature has been added.

Best regards,

Rob
Posted 15 Nov, 2011 03:42:14 Top
Andrei Smolin


Add-in Express team


Posts: 17239
Joined: 2006-05-11
Rob,

We will see if we can add this feature in the next build.

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 15 Nov, 2011 10:01:03 Top
Andrei Smolin


Add-in Express team


Posts: 17239
Joined: 2006-05-11
Hi Rob,

We've looked at the supposed way to implement this functionality revealed the fact that this way doen's exist for us. It should be implemed in your code. We've developed a sample for you.

public static string MyFunction()
{
    if (Module.IsInFunctionWizard && !IsInFindAndReplace())
    {
        return "IsInFunctionWizard == true";
    }
    return new Random().Next(1000).ToString();
}

[DllImport("user32.dll")]
private static extern IntPtr GetActiveWindow();
[DllImport("user32.dll")]
private static extern int GetClassName(IntPtr hwnd, 
    [MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder buf, 
    int nMaxCount);
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]

private static extern int GetWindowText(IntPtr hWnd, System.Text.StringBuilder lpString, int nMaxCount);

private static bool IsInFindAndReplace()
{
    IntPtr hWndActiveWindow = GetActiveWindow();
    if (hWndActiveWindow != IntPtr.Zero)
    {
        System.Text.StringBuilder cname = new System.Text.StringBuilder(256);
        GetClassName(hWndActiveWindow, cname, cname.Capacity);
        System.Text.StringBuilder windowText = new System.Text.StringBuilder(256);
        GetWindowText(hWndActiveWindow, windowText, windowText.Capacity);

        if (cname.ToString().StartsWith("bosa_sdm_XL") &&
            windowText.ToString().ToLower().Contains("replace"))
        {
            return true;
        }
    }
    return false;
}


The string "replace" above is a constant; this approach is applicable only to an English-language Excel. It doesn't allow us to integrate this code in Add-in Express: we don't know that constant in a localized Excel version.

Oh, if you use VB.NET, please use any online code conversion tool...

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 30 Nov, 2011 07:11:35 Top