Solved

Send parameters to Ms Outlook

Posted on 2000-05-16
4
247 Views
Last Modified: 2008-02-20
In a vb prog, I have to, from, subject and message textboxes.

If I press the button, this vb prog will bring up Ms Outlook and send
contents from those textboxes into
the fields in Ms Outlook. How do I do that ?
0
Comment
Question by:sing_web
  • 2
  • 2
4 Comments
 

Expert Comment

by:Bebeirken
ID: 2816014
You could try something like this :

Set vMail as Outlook.Mailitem

vmail.subject = txtsubject.text
vmail.to = txtto.text
vmail.from = txtfrom.text
vmail.body  = txtbody.text

vmail.send

I think it should work.

0
 

Accepted Solution

by:
Bebeirken earned 50 total points
ID: 2816876
I've been working on it some more and this seems to work :

dim vMail as clsmessage

Set vMail = New clsMessage
 vMail.Subject = 'subject text
 vMail.Body = 'Body text
 vMail.HeaderTo =  'email            
 vMail.Send
Set vMail = Nothing


The clsmessage looks as follows :


Public HeaderTo As String
Public HeaderFrom As String
Public Subject As String
Public Body As String

Private mMail As Outlook.MailItem
Private mOutlook As Outlook.Application

Public Sub Send()
    mMail.To = HeaderTo
    mMail.Subject = Subject
    mMail.Body = Body
   
    mMail.Send
End Sub

Public Property Get MailItem() As Outlook.MailItem
    Set MailItem = mMail
End Property

Public Property Set MailItem(aMailItem As Outlook.MailItem)
    Set mMail = aMailItem
End Property

Public Property Get Attachments() As Outlook.Attachments
    Set Attachments = mMail.Attachments
End Property

Public Property Set Attachments(aAttachments As Outlook.Attachments)
    Set mMail.Attachments = aAttachments
End Property

Private Sub Class_Initialize()
    Set mOutlook = New Outlook.Application
    Set mMail = mOutlook.CreateItem(olMailItem)
End Sub

Private Sub Class_Terminate()
    Set mMail = Nothing
    Set mOutlook = Nothing
End Sub

You will probably not need all of this. It seems to work just fine.
0
 

Author Comment

by:sing_web
ID: 2818315
What if I just want the field to be
copied and pasted into the Ms Outlook,
and not send the mail right away ?
0
 

Author Comment

by:sing_web
ID: 2818328
What if I just want the field to be
copied and pasted into the Ms Outlook,
and not send the mail right away ?

>> So, I can type the body by myself,
   but the to, from and subject are  
   pasted.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

740 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