Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default send email macro not working completely.....

Hello

I have a macro that does lots of things with multiple spreadsheets.
The wokbook in which the macro is running is not actually used for
anything as it is only a template.

I have a sheet within the spreadsheet called users and I want to email
the user should the UserName function match.

I have a function already to give me the username logged into the LAN,

I just dont know how to select the workbook where the users sheet is
and then ask it to match the username with that in column A and if
found send an email to the email address in column b.

I hope this makes sense,

Here is what I have so far,

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 =
.CC = ""
.BCC = ""
.Subject = Sheets("Summary").Range("D6").Value & " - Prelim"
.Body = strbody
.DeleteAfterSubmit = True
.Display
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub


It just keeps failing on me.

I appreciate your help,

Andrea

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
Macro to send email BAKERSMAN Excel Discussion (Misc queries) 0 April 2nd 10 01:28 AM
Please help VBA code not working properly send email when due dates Tia[_3_] Excel Worksheet Functions 0 July 21st 09 08:37 AM
macro to send email scheduler Excel Discussion (Misc queries) 2 October 18th 07 11:20 PM
Send email from a VBA macro? Peter Chatterton[_4_] Excel Programming 3 December 2nd 06 10:54 AM
how do i send email from a macro dok112[_18_] Excel Programming 3 June 25th 04 03:30 AM


All times are GMT +1. The time now is 06:30 PM.

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"