Need code to send a form

J

jjones

I frequently use VB code in Excel (with much help from these discussion
forums) but this is my first real try at creating an Outlook form. I have
created my form (using step-by-step in instructions from the
www.outlookcode.com site) and I've added a command button that says "Submit".
All I really want this button to do is send the form (same as clicking the
normal send button, I just don't know how to write that code). I already
have the "To" field defaulted to my own address, I just need to know how to
fire this thing off, and how to set the subject line.

Thanks in advance!
 
S

Sue Mosher [MVP-Outlook]

Sub CommandButton1_Click()
Item.Send
End Sub

Item is an intrinsic object that represents the item where the code is
running. Use the object browser (F2 in VBA) to look up properties and
methods.
 
J

Jeremyb

Is there a away to put a check in here so that the user can confirm the send.


I have:
Sub CommandButton1_Click()
MsgBox "Confirm to send this message."
Item.Send
End Sub

But I would like an option for the user to say Yes or No.

Is this possible and how is it codeed


Jeremy
 
S

Sue Mosher [MVP-Outlook]

You need to use MsgBox as a function to give you a return value:

res = MsgBox("Do you really want to this message?", vbYesNo, "Confirm Send")
If res = vbYes Then
Item.Send
End If

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 

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

Top