?
Solved

Command Button to send Office 2007 form

Posted on 2010-01-11
16
Medium Priority
?
643 Views
Last Modified: 2013-12-17
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
0
Comment
Question by:David627
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 7
16 Comments
 
LVL 76

Expert Comment

by:David Lee
ID: 26285489
Hi, David627.

Will the button in question be on the custom form or is it a toolbar button?
0
 

Author Comment

by:David627
ID: 26285563
Custom form
0
 
LVL 76

Accepted Solution

by:
David Lee earned 2000 total points
ID: 26291500
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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

Author Comment

by:David627
ID: 26326474
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
 
LVL 76

Expert Comment

by:David Lee
ID: 26326511
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
 

Author Comment

by:David627
ID: 26352855
Where do I enter the code because I tried in teh scipt window and the VBA window and neither worked...
 
Thanks
David
0
 
LVL 76

Expert Comment

by:David Lee
ID: 26352909
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
 

Author Comment

by:David627
ID: 26398487
will try - thanks!
0
 

Author Comment

by:David627
ID: 26398575
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
 
LVL 76

Expert Comment

by:David Lee
ID: 26402705
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
 

Author Comment

by:David627
ID: 26404330
We aren't getting where in Outlook 2007 to place the code - give me instructions from the form please....


0
 
LVL 76

Assisted Solution

by:David Lee
David Lee earned 2000 total points
ID: 26404392
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
 

Author Comment

by:David627
ID: 26421965
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
 
LVL 76

Expert Comment

by:David Lee
ID: 26422043
You're welcome, David.
0
 

Author Comment

by:David627
ID: 26611691
My comment of 1/27 says it all - since I'm sure it works I will grant points
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
This article will help to fix the below error for MS Exchange server 2010 I. Out Of office not working II. Certificate error "name on the security certificate is invalid or does not match the name of the site" III. Make Internal URLs and External…
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question