Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to send email | Excel Discussion (Misc queries) | |||
Please help VBA code not working properly send email when due dates | Excel Worksheet Functions | |||
macro to send email | Excel Discussion (Misc queries) | |||
Send email from a VBA macro? | Excel Programming | |||
how do i send email from a macro | Excel Programming |