When automating excel using the Excel Interop API, I can easily search for a range using the Range.Find method . I am looking at LookIn, LookAt, SearchOrder, SearchDirection, and MatchCase options for Find. This, as indicated in the MSDN documentation, saves the values passed to this method to user settings, so the next time the user opens the search form, the parameters that I used in the Range.Find method will be selected.
I need to save the values of the search parameters before and after I find the software find. Therefore, I want to capture the current search parameters, then execute Range.Find, and then set the search parameters back to the parameters that were set before my search. However, I don’t see the search options publicly available. Any ideas on how to get them?
I am mainly looking to get the current values of the search options for LookIn, LookAt, SearchOrder, SearchDirection and MatchCase.
Update
The most interesting thing I can find so far is access to the dialog boxes of the Excel application - Dialog interface . Therefore, here I can access the FormulaFind dialog box, which is slightly different from the Find and Replace dialog box, although it may lead to some of the properties I'm looking for. I was not lucky, but maybe there is a way to access properties through this form using reflection. I will continue to do something about it.
Excel.Dialog dialog = this.Application.Dialogs.Item[Excel.XlBuiltInDialog.xlDialogFormulaFind];
source
share