I'm trying to access the "Find & Select" menu in Excel by using SendKeys through VBA.
When I am simply in Excel, I can access the "Find & Select" menu via the following keystrokes: (Alt + H) → (F D). Try it on your own Excel, it works! You can also see that when you only type (Alt + H) → (F), what it does is limit your alt shortcuts to those that begin with the letter "F", as follows.
However, when I try to do an identical maneuver in VBA using SendKeys, I am able to successfully send the (Alt + H) command and successfully send the letter "F". However, after doing so, the majority of alt shortcuts are greyed out and unavailable. Attempting to use SendKeys to send the letters for one of these shortcuts does not work.
You can see that the only available alt shortcut in the image is "FO". If I use VBA to send that combination of letters, it works! But none of the letter combos for the greyed out shortcuts do. Does anyone know why this is happening? Code used to obtain this result is seen below.
Dim newWB As Workbook
Set newWB = Workbooks.Add
With newWB
.Activate
Application.SendKeys ("%h") ' send Alt+H
DoEvents
SendKeys ("f")
DoEvents
End With
Note: I am aware that SendKeys is awful. In reality I'm not actually trying to access The Find & Select menu, I'm trying to access a different menu which I have not had any luck accessing in any other way, and SendKeys seems like the only option for that. This was just the clearest way to present the problem.