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?
0
Jerry
1/27/2010 10:20:50 PM
excel.programming 6508 articles. 2 followers. Follow

1 Replies
690 Views

Similar Articles

[PageSpeed] 53

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 BuildAndSend("Paul@Email.com", "annual bonus", "Hi Paul your 
annaul bonus is $1000", False)
    Case "John"
      Call BuildAndSend("John@Email.com", "annual bonus", "Hi John your 
annaul bonus is $2000", False)
    Case "George"
      Call BuildAndSend("George@Email.com", "annual bonus", "Hi George your 
annaul bonus is $3000", False)
    Case "Ringo"
      Call BuildAndSend("Ringo@Email.com", "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?
> .
> 
0
Utf
1/28/2010 2:19:02 PM
Reply:

Similar Artilces:

Auto Filter problem
I am using the auto filter for a particular column to sort out differen medical programs. When I click the drop down and click a program, i doesnt show me ALL the lines that say this particular program. Why is this? -- Message posted from http://www.ExcelForum.com Hi maybe some hidden characters in these lines 8e.g. additional space characters, etc.) -- Regards Frank Kabel Frankfurt, Germany "jkb724 >" <<jkb724.19rasx@excelforum-nospam.com> schrieb im Newsbeitrag news:jkb724.19rasx@excelforum-nospam.com... > I am using the auto filter for a particular column to so...

Populate a cell if values in cell 1 and cell 2 match cell 3 and 4
I need help with a formula please. I need to search through a column of data and populate a cell if it meets a condition. For example: IF FirstWorksheet!A2 = SecondWorksheet!ColumnAx and FirstWorksheet!B2 = SecondWorksheet!ColumnBx Then populate SecondWorksheet!Cx with value from FirstWorksheet!C2 I have to match up a column of data in one worksheet with data in 2 columns in another worksheet. Help plz. Thanks T- A multi-criteria index n match (array-entered) should work here In Sheet2, Copy n paste this into C2's formula bar, then array-enter the formula by pressing CTRL+...

MS outlook 2003 try to send email says "Item missing"
I am trying to use outlook for the first time, but won't send or recieve--says item missing. Thanks! Chrisie <Chrisie@discussions.microsoft.com> wrote: > I am trying to use outlook for the first time, but won't send or > recieve--says item missing. Did you create a mail profile? Did you define a mail account? Have you created your data store? Tell us exactly what you've done so far and we'll tell you if anything's missing. -- Brian Tillman Yes, I have done all those things... Thanks for your help! "Brian Tillman" wrote: > Chrisie <...

alternate UI for Define Names ??
I've just started using Define Names for storing formulas. I find thi to be very helpful, except the supplied interface (in Excel 2000) i limited (especially since some of the formulas are quite long.) I've figured out some workarounds that work fine, but I was wonderin if anyone has created a more flexible, or just larger, interface t Excel's Define Names. Thanks in advance for any help or suggestions -- jmg09254 ----------------------------------------------------------------------- jmg092548's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2611 ...

Bulk emailing
Is there any way to take 10-20 email addresses and send the same email text to each of them, where ONLY their email address appears anywhere in the header? Thanks! ....Robin Put the recipients in the Bcc: recipient box rather than the To: or cc: boxes. "Robin" <anonymous@discussions.microsoft.com> wrote in message news:01d601c39f27$0c1612e0$a501280a@phx.gbl... > Is there any way to take 10-20 email addresses and send > the same email text to each of them, where ONLY their > email address appears anywhere in the header? > > Thanks! > > ...Robin > &...

Auto-Editing
Word 2003 has a very annoying default. It assumes too much! If I reformat a few words in a document, it changes the entire document to that formatting. Grr-rrr-r! I have to constantly press undo to get what I want. I know there's a feature that's causing this annoyance but I can't find it to turn it off! Can anyone help, please? See http://word.mvps.org/faqs/formatting/wholedocumentreformatted.htm. -- Stefan Blom Microsoft Word MVP "Connie Martin" <ConnieMartin@discussions.microsoft.com> wrote in message news:CD959D82-F81B-4A9D-993E-73...

Can receive but not send emails
Task 'lrbutz@verizon.net - Sending' reported error (0x800CCC78) : 'Unable to send the message. Please verify the e-mail address in your account properties. The server responded: 530 5.7.0 No AUTH command has been given.' That is the error message I receive when trying to send a message from Outlook 2003, from a POP acct. Test messages at first were sent successfully, but now I only get the pop-up requiring me to repeatedly enter my user name and password, despite always re-checking the 'remember user name and password' box. This program worked yesterd...

Can Exchange administrators secretly read user's email without their knowlege?
This is a simple question and your help will appreciated. If I were an Exchange administrator, can I read a user's email without their knowlege? On 7 Jun 2006 06:44:37 -0700, "PizzaPete" <terryleemundy@comcast.net> wrote: >This is a simple question and your help will appreciated. If I were an >Exchange administrator, can I read a user's email without their >knowlege? Yes. With the proper permissions that arent there by default in E200x. http://support.microsoft.com/default.aspx?scid=kb;en-us;821897 "How to assign service account access to all mailboxe...

Auto-Calculate
I have a spreadsheet that utilize the stock quote add-in from MSN. On a daily basis I refresh the add-in functions for the Highs, Lows, Last, Volume, etc. On occasion the spreadsheet reverts to manual caculation settings, and I have to press the F9 even after I updated the quotes. I've always preferred the any spreadsheets I open, blank or otherwise, the automatic setting selected for calculations. I consider this an annoyance. Has anyone experienced this glitch? Is there a fix for it? Ron_D Ron Excel takes the calculation mode from the first workbook that opens in a session. Sub...

auto copy self
How do I arrange for Outlook to automatically copy myself on every new, reply or forward email? If you mean keep a copy of all sent, see settings under Tools/Options/Email Options and Advanced Options David "rich" <steamuk@aol.com> wrote in message news:055c01c3664f$dadecd30$a001280a@phx.gbl... > How do I arrange for Outlook to automatically copy myself > on every new, reply or forward email? ...

moderated & normal email
i have moderated email and normal email coming into the moderators inbox. how can i configure the moderator's outlook/email to differentiate between the two. moderator is running outlook 2003 with exchange 2003 enterprise. How about creating a rule in Outlook that will separate the e-mails based on the address they are sent to (moderator@domain.com as against normal@domain.com). RP wrote: > i have moderated email and normal email coming into the moderators > inbox. how can i configure the moderator's outlook/email to > differentiate between the two. moderator is running o...

Auto Scale Chart Macro -- Any improvements please?
This is the best way I've found to correctly scale a chart -- the only way I found to exclude a chart interpolating with #NA cells was to delete those cells containing #NA, and run the chart. This takes a long time on my computer. Wondering if there is a better way. This macro is directly taken from 2 excel mvps and modified; i believe a mehta and ron bovarty, but could be wrong. Thanks for taking a look. Sub AutoScaleYAxes() Dim ValuesArray(), SeriesValues As Variant Dim Ctr As Integer, TotCtr As Integer Application.Run "Extend_Stock_Data" Applic...

Auto correct or Auto complete
We are all familiar witht he auto correct or auto complete functions found in MS applications. Of course that means it is available in Access also. My question is this ... can this function be replicated within the DB, so that the set of auto correct items are part of the package rather than something that would have to be set up on each individual desktop system? It's use, for me, would primarily be within a memo field where medical abreviations, used as a shortcut, would convert to the true meaning as the user types them in. Ex: "prn" without quotes would change to. &qu...

OWA auto login
I am trying to use the credentials from the forms authentication login to automaticaly log in to Outlook Web. I redirect to a URL with this format: http://UserName:Password@mailserver/exchange I have seen this example in other posts but this does not work for me. I still get the Outlook Windows Login prompt. Perry Perecli Manole wrote: > I am trying to use the credentials from the forms authentication > login to automaticaly log in to Outlook Web. I redirect to a URL with > this format: http://UserName:Password@mailserver/exchange > I have seen this example in other posts but t...

Email Setup?
We may have missed a step in connecting our CRM 1.0 server and Exchange 2003. We are in the process of setting up CRM. We create an email activity and try to send it but get the message "an error occurred ... contact your system administrator". In the event log on the CRM server we get the message: MSCRM Platform Error Report: ---------------------------------------------------------------------------- ---------------------------- Error: <description>An unexpected error occurred.</description><details>An error occurred attempting to dispatch the email : HTTP st...

emails received
I received an email from someone and it keeps sending me 100's of copies of the same email from the same date and time. My inbox is no longer getting my normal emails and I've tried blocking this person but it still sends the emails. When I click on send and receive is says retrieving message 1 of 16 but only one message comes in (the junk one) and then an error message appears saying: Your server has unexpectedly terminated the connection. Possible causes for this include server problems, network problems, or a long period of inactivity. Account: 'pop.telus.net&...

Auto look through subfolders
Please help. I can write a macro that will extract data from all excel files in a specific folder. What I need to be able to do is write a macro that will automatically extract data from excel files within folders and sub folders and sub sub folders etc For example the data is all held on the following directory: H:\development forms\2006 cost sheets\ And within that directory by customer - for example Tesco, Boots, Asda etc. These customers are then subdivided into product ranges - eg 1,2,3,4 etc and some futher subdivided by national or exclusive. All the excel files are in exactly th...

emails
every time i try to open my outlook express it comes up with an error The host 'pop3' could not be found. Please verify that you have entered the server name correctly. Account: 'pop3', Server: 'pop3', Protocol: POP3, Port: 110, Secure(SSL): No, Socket Error: 11001, Error Number: 0x800CCC0D any ideas i am not sure what to do Hi Lynne, 1. you won't get a reply here, post OE questions to microsoft.public.windows.inetexplorer.ie6_outlookexpress 2. in tools - accounts - mail - your mail account - properties - servers you specified a wrong POP3 server. You typed &#...

Any way to get rid of an auto-suggestion in the login dialog box, for Exchange/OL using RPC over HTTP?
A client was using RPC over HTTP to two different Exchange servers (OL prompting for profile on startup). Both profiles were set up to prompt for credentials upon connection to Exchange. There's now only one Outlook profile needed; the other is gone and OL isn't prompting for the profile selection any longer, which is fine. However, Outlook is remembering domain1\user and domain2\user in the login dialog box, and I'd love to be able to get rid of the no-longer-valid credential dropdown suggestion. (The computer is not a member of a domain and hence always needs to be prom...

Linking to email...
I want to be able to automatically create an email with an attached text file. I don't necessarily want to link to Outlook, rather just whatever email software they use. I have tried a ShellExecute using "MailTO", but that won't allow an attachment, so I tried the following code, but simply nothing happens! The following code appears to run OK, all pointers look valid and the message box pops up at the end saying email sent, but nothing arrives. Here is the code I have tried: ======================= char* logPathName; logPathName = filePath.GetBuffer(0); MapiFileDesc attach...

An auto reply to an auto reply!
Had the funniest situation yesterday. Somebody emailed a public folder we have set up. On there we have a rule to send a reply saying thanks for your email -someone will be with you shortly (we have to have this message on - it is for some website that recently went live). Now that auto reply went back to the guy who emailed - who must have sent it from a public folder himself (as he forwarded the original email from a public folder). The guy received our auto reply - and promptly his email system sent an auto reply to us. As is the way it is set up - our email system sent him an auto ...

Auto date
I am trying to create a field in a form that if anything is changed on it, it will automatically update the date to current date. Is this possible? Sojaminc wrote: >I am trying to create a field in a form that if anything is changed on it, it >will automatically update the date to current date. Is this possible? Make sure the last changed date/time field is in the form's record source table/query. Then use the form's BeforeUpdate event: Me.lastchanged = Now -- Marsh MVP [MS Access] Hi - You can do this in the On Dirty event of the form, which fires as soon as you m...

saving multiple emails with attachments in Outlook 2003
Hi, I want to be able to save multiple email messages along with their attachments. Into a folder on my computer. I know that I can select the email, and then go to the File -> Save As.. and save the email with its attachment as type outlook message (.msg) to do the job for a single email. Is there a way to do this quickly for many emails all at once? When you're dealing with 100+ emails doing it that way just takes way too long. Thanks! The easiest way to save multiple email messages is to create a new Personal Folder (called a .pst file) and move the messages into that f...

Auto-Alphabetize
I have a master data sheet, with columns of different information. I'd like to pull information from 3 different columns (Rank,LastName,Shift) into a separate column (I know how to do this). What I would then like to have happen is, in another separate column, have the information sorted alphabetically by last name. There are duplicate last names, in which case I'd like them sorted in rank order. Is this at all possible? Also, I can't use a VB Macro - it needs to be in a formula or array format. Rank.......LastName.........Shift PO Smith B/1 ...

Multiple sendings of emails
Hi, Can anyone explain why my Outlook 2003 is sending emails that have more than one recipient multiple times . It occurs with distribution lists and with emails with multiple recipients. This isn't a consistent behaviour but frequent enough to be a major productivity hassle. (We have recently changed ISP, but thus far believe the ISP that it is not a fault with their service). Thank you, Graham Does your antivirus scan outgoing email? That often causes such problems. -- Diane Poremsky [MVP - Outlook] Need Help with Common Tasks? http://www.outlook-tips.net/beginner/ Outloo...