More Outlook Resource Sites

Microsoft Developer Network (MSDN)

FAQs and other general resources

forum 24-May-2018 19:43

Looking for help with Outlook programming projects — VSTO, add-ins, VBA, custom Outlook forms, etc.? You′ve come to the right place!

NEW! >> Subscribe to this site via RSS. For more RSS options, see the complete list of feeds on our main news page.

    Page [ 1 ]  
 Outlook Form Design Printer Friendly Version
Designing custom Outlook forms and form regions and writing code for them
Remove send Button
I want to remove default send button from the mail message of customized mail. is possible to remove with code???

I have my own button for sending.

  09-Mar-2006  00:11
  09-Mar-2006  04:03   

Why? Any code you need to run on Send you can put in the Item_send function. I have not realy played with Actions yet but aren't you just complicating matters by having your own send button.

There maybe a very good reason for it in which case I am sure someone else will advise how to do what you want.
  09-Mar-2006  07:22   
i have made my own send button in the outlook form itself. i want that send button in the top menu to be removed with code. anyway thanx simon
  09-Mar-2006  10:23   
Naresh, you'd have to use CommandBars and live with it affecting ***all*** other open message windows, whether they use your custom form or not. SEe
  10-Mar-2006  00:50   
Hi Naresh,

I had the same requirement to use a button that I created instead of waiting for the Item_Send to occur. The reason was that I needed to create a standard email based on the custom form that the user has filled up. The problem is that if I use the Item_Send, I cannot do a Item.Close olDiscard inside the Item_Send as this causes the write to go haywire saying the item was either deleted or moved.

To overcome that, I simply redirected the user to use the button that I created to send the email.

Function Item_Send
   MsgBox ("Please use the button on the top of the form to send the mail")
   Item_Send = False
End Function

Sub MySendButton_Click
   ''What ever
End Sub
  10-Mar-2006  05:16   

I like the thinking but doesnt that just prevent any send of the item? You could take it a step further though by setting a boolean in MySendButton_Click

Dim bSend

Function Item_Send
If not bSend then
   MsgBox ("Please use the button on the top of the form to send the mail")
   Item_Send = False
  Item_Send = True
End If
End Function

Sub MySendButton_Click
   ''What ever and then
     bSend = true
    bSend = false
End Sub

That way the item can only be sent by pressing your button.

  11-Mar-2006  03:20   
Hi Simon,

I get what you mean. This is neccesary if the statement is Item.Send inside the MySendButton_Click. I have the feeling that Naresh had created his own button because he needed to create a standard email for people that are outside of his organization. In this case, the code will be

Sub MySendButton_Click
     olMailItem = 0

     Set myRealMail = Application.CreateItem(olMailItem)
     myRealMail.To = Item.To
     myRealMail.Subject = Item.Subject
     myRealMail.Body =Item_Body
      Item.Close olDiscard
End Sub
    Page [ 1 ]