MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Opening DropDown fields on Entry?

  Asked By: Brayden    Date: Mar 15    Category: MS Office    Views: 2035

Does anyone have techniques for opening a pulldown FormField automatically
upon entry?

This EntryMacro seems to work fairly well:

Sub OpenDropDown()
SendKeys "%{DOWN}" 'Alt+Down
End Sub

But it doesn't seem to work correctly if I try to back up to a field using
Shift-Tab. Clicking on the field works and Tabbing to it works, but not
Shift-Tabbing back to it.

Any ideas?



3 Answers Found

Answer #1    Answered By: Deloris Harris     Answered On: Mar 15

Have you checked that the macro is actually being fired on the shift-tab?

Answer #2    Answered By: Luisa Fischer     Answered On: Mar 15

Yes, the Entry Macro is firing. I think the problem is that when you press
Shift-Tab, the Shift key is depressed, and then SendKeys fires, and I THINK
the computer is seeing Shift-Alt-Down, instead of just Alt-Down. This
keystroke simply moves you to the next field, and since Shift-Tab moves you
to the previous field, that's why I don't see ANY effect, because the two
keystrokes are canceling each other out!

I did find out that Up and Down move you just as nicely from field  to field
as Tab and Shift-Tab, and they don't have this problem (since you're not
using the Shift key), so I don't feel so bad if the user can't hit Shift-Tab
-- I'll just tell them to use Up.

So thanks -- you helped me look into it deeper and find my workaround.

Answer #3    Answered By: Eshe Chalthoum     Answered On: Mar 15

This could well be the cause. I've never looked for it, but presumably there's
a function that allows you to read the keyboard scan codes from VBA. You could
put the code into a hard loop waiting until the shift key was released before
doing your SendKeys.

Didn't find what you were looking for? Find more on Opening DropDown fields on Entry? Or get search suggestion and latest updates.