MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Ctrl + f, "Find Object"


Posted by Joe Was on November 01, 2001 7:49 AM

Does anyone know how to call the "Find utility object"
with VB code?

The VB Find code only works with parameters and uses a different form, than the standard, activated by "Ctrl + f." I would like to code a Form Button to activate the standard "Ctrl + f, Find-Search" utility as is.

I have re-built the object by loading ComboBox variables, but it does not look the same. I would like to use the standard, but can't seem to open it with VB code?


Posted by Ivan F Moala on November 02, 2001 1:29 AM


Try

Application.CommandBars.FindControl(ID:=1849).Execute

Ivan

Posted by Joe Was on November 02, 2001 5:23 AM

Code opened the utility, but..

Your code worked to display the search utility, but it does not seem to work the utility correctly. It fails to search, I changed the options and it sill it does not work, but if I close it and re-open it with Ctrl + f and not the code you supplied it works fine?

Any ideas?

I did not know about the ID codes. How did you know which code to use?

JSW

Posted by Joe Was on November 02, 2001 6:25 AM

Only works when Cells are selected?

The only way I could get the search to work is by selecting all the cells?

Sub mySearch()

Cells.Select
ActiveWindow.ScrollRow = 1

Application.CommandBars.FindControl(ID:=1849).Execute

Application.ActiveCell.Select

End Sub

The code highlights the whole sheet (Darkens it), but highlights a found cell to the automatic default cell color. On close the sheet returns to the normal color and the found cell is selected. Its not the way the Ctrl + f search works?

Any idea on how to select the sheet for the search without highlighting the sheet?

Could the search be made to work on the whole workbook not just a sheet?

Thanks Ivan

JSW Your code worked to display the search utility, but it does not seem to work the utility correctly. It fails to search, I changed the options and it sill it does not work, but if I close it and re-open it with Ctrl + f and not the code you supplied it works fine? Any ideas? I did not know about the ID codes. How did you know which code to use? JSW :