LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Macro to send email to person in workbook list of users

I have a macro which sends an email based on the values from one
workbook,

What I want the macro to do is to send the email to the person whose
userid is located in Users.... which is in another workbook
completely. So the macro should lookup the username in column A and
then send the email based on what is in column b next to the found
username in column A.

How is this possible using my macro below?

Private Sub MailMessage()
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim emailmanager As String

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

strbody = "This has been created by: " & UserName

If UserName = Range("A1:A100") Then Cells.Select
End If
With OutMail
.To = ANOTHERWORKBOOK.Sheets("Users").Cells.Offset(0, 2).Value
.CC = ""
.BCC = ""
.Subject = Sheets("One").Range("D6").Value & " - Prelim"
.Body = strbody
.DeleteAfterSubmit = True
.Display
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub


Thanks alot

Andrea

 
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
Send an email to entire list one at a time? Parshooter New Users to Excel 1 April 21st 07 02:13 PM
send excel workbook as attachment to multiple users guz Excel Programming 1 February 21st 07 02:58 PM
Send an email to a list of emails in a worksheet cexarsiado New Users to Excel 2 August 22nd 06 03:04 PM
Can I email unique worksheets from a workbook to different users? Laura Excel Discussion (Misc queries) 1 November 18th 05 09:52 PM
email sheets 2,3,4,5 ect. to users from a list on sheet1 swieduwi Excel Programming 7 June 13th 05 04:01 PM


All times are GMT +1. The time now is 09:31 AM.

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

About Us

"It's about Microsoft Excel"