Command Button to send Office 2007 form

I have a custom form in Outlook 2007 which is based on an appointment. For the ease of the users I would like them to be able to send right from the form rather than going back to the appointment tab. Can anyone assist with the code that would go in the command button that can allow the user to send this form to the addressee already in the TO field?

Thanks
David
David627Asked:
Who is Participating?
 
David LeeConnect With a Mentor Commented:
Add a command button to the form  In the button's click event add the command Item.Send.  Like this

Sub CommandButton1_Click()
    Item.Send
End Sub

Change the control name, i.e. CommandButton1, as needed.
0
 
David LeeCommented:
Hi, David627.

Will the button in question be on the custom form or is it a toolbar button?
0
 
David627Author Commented:
Custom form
0
Easily manage email signatures in Office 365

Managing email signatures in Office 365 can be a challenging task if you don't have the right tool. CodeTwo Email Signatures for Office 365 will help you implement a unified email signature look, no matter what email client is used by users. Test it for free!

 
David627Author Commented:
can't find how to attach code to command button.  Its not like Access where there is a property sheet that links to an OnClick proccedure.
 
David
0
 
David LeeCommented:
You don't have to attach code to the button.  You just have to create the subroutine I listed.  Controls generate a Click event automatically.  That event fires the code in the subroutine named ButtonName_Click where ButtonName is the name of your button.
0
 
David627Author Commented:
Where do I enter the code because I tried in teh scipt window and the VBA window and neither worked...
 
Thanks
David
0
 
David LeeCommented:
It goes in the code window of the form.  It does not go in the VBA window.  Did you match your button's name to the name I used in code?  For example, if your button's name is MyButton, then the subroutine name will be

Sub MyButton_Click()

0
 
David627Author Commented:
will try - thanks!
0
 
David627Author Commented:
In the view code window I entered:
Sub cmdSend_Click()
    Item.Send
End Sub

cmdSend is name of button.  Once published get a invalid character line 2
0
 
David LeeCommented:
I tested your code exactly as you posted above.  It worked fine for me.  As a test try replacing

    Item.Send

with

    Msgbox "Fired"

When the button is clicked a dialog-box should pop up.
0
 
David627Author Commented:
We aren't getting where in Outlook 2007 to place the code - give me instructions from the form please....


0
 
David LeeConnect With a Mentor Commented:
1.  Open the form in Outlook's form editor (Tools > Forms > Design a Form).
2.  Open your form.
3.  Click the View Code button located in the Form section of the ribbon.
4.  Enter the code.
5.  Test the code immediately by clicking the Run This Form button which is directly below the View Code button on the ribbon.
0
 
David627Author Commented:
followed your instructions to the letter - still get the "invalid character line 2" error.  Even though I can't verify it, I'm sure your code works just not sure what is wrong. At this point we are abandoning the command button option - too much time spend on this - users can go to the previous tab
Thank you for your efforts.
David
0
 
David LeeCommented:
You're welcome, David.
0
 
David627Author Commented:
My comment of 1/27 says it all - since I'm sure it works I will grant points
0
All Courses

From novice to tech pro — start learning today.