Mark
asked on
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
vbButton.jpg
select the object name in "1" then the event in 2 (click or double click)
ASKER
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)?
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)?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
did you tried to remove the button and add it again?
ASKER
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!!!
ASKER
One last thing and I'll close out this question. Just to confirm: is "Unload Me" the correct way to close a form?
I think unload me is fine