Solved

Send parameters to Ms Outlook

Posted on 2000-05-16
4
248 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
[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
  • 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sorting multiple rows and columns, and count duplicates in Excel 2013 4 100
Problem to With line 4 85
vbModal 12 73
Count text color with conditional formating in Excel 4 65
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

739 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