Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Auto populate Email when Name is chosen

I have a list of names which i present in a combo box on the userform.
I have an email textbox. I want the email to be auto-populated based
on the name chosed. May I ask your help with this?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 921
Default Auto populate Email when Name is chosen

Hi Jerry, Only the first procedure is really relevant in this post the
others are to show how you may want to call it but, that entirely depends on
your needs. Private sub BuildAndSend has 4 required parameters €śToWhom€ť,
€śSubject€ť,€ťBody€ť, and €śSend€ť. Pass the appropriate values to the procedure
and it will send or display an email to the user to send.
HTH.


Private Sub BuildAndSend( _
ByVal ToWhom As String, _
ByVal Subject As String, _
ByVal Body As String, _
ByVal Send As Boolean)

Dim Outlook As Object
Dim Mail As Object

Set Outlook = CreateObject("Outlook.Application")
Outlook.Session.Logon
Set Mail = Outlook.CreateItem(0)

With Mail
.to = ToWhom
.Subject = Subject
.Body = Body
If Send = True Then
.Send
Else
.Display
End If
End With

Set Outlook = Nothing
Set Mail = Nothing
End Sub

Private Sub ComboBox1_Change()
Select Case ComboBox1.Value
Case "Paul"
Call ", "annual bonus", "Hi Paul your
annaul bonus is $1000", False)
Case "John"
Call ", "annual bonus", "Hi John your
annaul bonus is $2000", False)
Case "George"
Call ", "annual bonus", "Hi George your
annaul bonus is $3000", False)
Case "Ringo"
Call ", "annual bonus", "Hi Ringo your
annaul bonus is $4000", False)
End Select
End Sub

Private Sub UserForm_Initialize()
Dim NameArray As Variant
Dim I As Long
NameArray = Array("Paul", "John", "George", "Ringo")

For I = LBound(NameArray) To UBound(NameArray)
ComboBox1.AddItem NameArray(I)
Next
End Sub


"Jerry" wrote:

I have a list of names which i present in a combo box on the userform.
I have an email textbox. I want the email to be auto-populated based
on the name chosed. May I ask your help with this?
.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Populate Date when specific entry is chosen from data validation btrich14 Excel Worksheet Functions 1 August 4th 10 03:56 PM
Populate combo box, then hide rows that don't match chosen value Finny Excel Programming 1 June 8th 08 12:51 AM
How do I create an email macro to auto fill the email? Justin[_4_] Excel Discussion (Misc queries) 0 November 14th 07 10:49 PM
Auto-filtering based on a value chosen in a combo box? Dan Excel Discussion (Misc queries) 0 November 6th 07 03:51 PM
Auto-populate, Auto-copy or Auto-fill? Jay S. Excel Worksheet Functions 4 August 10th 07 09:04 PM


All times are GMT +1. The time now is 04:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"