Getting Outlook VBA Command Buttons to work

I'm creating the VB macro and form shown in the attachment. I've create 2 button. Now I want the buttons to *do* something. In VB/Access the button properties dialog had an 'Events' tab with events like 'On Click' which is where one could enter the action code. I see no such mechanism in Outlook on the CommandButton properties. How do I do this?
vbButton.jpg
LVL 1
jmarkfoleyAsked:
Who is Participating?
 
FarWestCommented:
here is a sample from my outlook 2010, no code for forms , blank  click event code was initialized when double click the button, when selecting events all available events are displayed in drop down
ee-code2.jpg
0
 
FarWestCommented:
select the object name in "1" then the event in 2 (click or double click)
ee-code.jpg
0
 
jmarkfoleyAuthor Commented:
FarWest: That simply selects the Sub I created, but doesn't appear to connect it to the button. If I remove my CommandButtonRed_click() function, there is nothing in (2) except the name of the main function.

Running the module (F5) and clicking on the "Red Category" button does nothing -- does not execute my CommandButtonRed_click() function (which I've changed to a Msgbox())

Simply creating the <buttoName>_Click() function apparently is not enough to fire the event when the button is clicked. How do I do this? Why is there no onClick property in the button object properties list (rhetorical question)?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
FarWestCommented:
did you tried to remove the button and add it again?
0
 
jmarkfoleyAuthor Commented:
Ah Ha!!! Thank you, thank you! I cannot put the event code in the module with the [form].Show function. I have to right click on Forms > MyFormName and select 'View Code'. That gives me the view shown in your image. All my command buttons are shown in the left drop-down, and all the associated events are shown in the right drop down. When I put my MsgBox("red") line in there, it works!!! Sheesh! This is nothing like the VB/Access development studio!!!
0
 
jmarkfoleyAuthor Commented:
One last thing and I'll close out this question. Just to confirm: is "Unload Me" the correct way to close a form?
0
 
FarWestCommented:
I think unload me is fine
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.