How to assign code to a command button?

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hello,

I have created an Outlook form, with a command button called cmdSend.

I have also created a sub as below

Sub cmdSend_click
msgbox "sent"
End Sub

I just can't figure out how to bind the code to the button. Where
should the code go?

At the moment it is in "ThisOutlookSession" "Application", but this
can't be right as it doesn't run when clicked.

I haven't used Outlook before. In other office apps there is an
option to assign a macro to a control, but I can't find anything like
that here.
Can anyone explain?


Any help would be very much appreciated.

Many thanks

John
 
The code needs to go in the code editor for the custom form. In design mode,
there's a button for View Code.

ThisOutlookSession is for VBA code. Not related to forms at all.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top