Solved

Send parameters to Ms Outlook

Posted on 2000-05-16
4
245 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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Access 2013 combo box not working 3 46
Add and format columns in vb6 7 59
How to make an ADE file by code? 11 87
vb6 - Transfer from MSHFlexgrid1 to xls issue 8 52
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

832 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