The following is a dependable squirt of code that forces a check-styled menu sub-item to stay down when selected. Isn't it annoying of you want to set several checks "on" that are all several levels down in the hierarchy? Well, here's a sample of code that allows you to keep that menu down:
Sub mnuToggle_Click (Index As Integer)
Dim pintCounter%
mnuToggle(Index).Checked = Not (mnuToggle(Index).Checked)
SendKeys "%T", False
For pintCounter = 0 To Index - 1
SendKeys "{DOWN}", False
Next pintCounter
End Sub
Sub mnuAToggle_Click (Index As Integer)
Dim pintCounter%
mnuAToggle(Index).Checked = Not (mnuAToggle(Index).Checked)
SendKeys "%TA", False
For pintCounter = 0 To Index - 1
SendKeys "{DOWN}", False
Next pintCounter
End Sub
You'll note that these are all menu control arrays. You can do it to non-array items but there is a little more typing involved. I did it this way for size and clarity.
|