Send Mail Through VBA

Nov 23, 2009

I have written a code to send e-mail with attachments. However, the mail doesn't include my standard signature.

For I = 2 To 8

Set MItem = OutApp.CreateItem(0)
With MItem
.to = wb.Sheets("Mail").Range("C" & I).Value
.Cc = wb.Sheets("Mail").Range("D" & I).Value
.Bcc = wb.Sheets("Mail").Range("E" & I).Value
.Subject = wb.Sheets("Mail").Range("F" & I).Value
.body = wb.Sheets("Mail").Range("G" & I).Value

For Each fil In fldpdf.Files
LenFilName = Len(wb.Sheets("Mail").Range("B" & I).Value)
If wb.Sheets("Mail").Range("B" & I).Value = Left(fil.Name, LenFilName) Then
MItem.Attachments.Add fldpdf & "" & fil.Name
Exit For
End If
Next fil

.display
End With
Next I

View 14 Replies


ADVERTISEMENT

Send Mail On Last Day Of Every Month If Last Day Is Saturday / Sunday Send Mail On Thursday

Mar 11, 2014

I am trying to write a macro to send mail on every Friday and also on last day of every month. If the last day of the month falls on Saturday or Sunday then the macro should mail on Friday. I have written a separate macro to send a mail. I have also written to check day(ie Monday, Tuesday etc) of today. If today is Friday or month end i can send mail. I dont know how to tell the macro to send mail on friday if the month last date is saturday or sunday.

Sub done()
Dim Dat As Date, x As Integer, y As Date, sorry As String
Dim str As String
sorry = "Today is not friday or month end. So i cannot send mails"
str = WeekdayName(Weekday(Now()))

[Code] ........

View 1 Replies View Related

Send E-mail

Jan 5, 2007

I have a spread sheet with all vehicle drivers license expiration dates. there are about 300 drivers to track.

What I am looking for is a way to have an E-mail sent to me 30 days prior to the expiration date with that persons name and date of expiration so I can forward the e-mail to his supervisor. And I need this to happen without having to open the file every day. ("Excel" itself will open daily, if that helps. )

Note: I am using me as the first person, actually this will be for our fleet manager.

I have searched Google and this board this whole week and all I can find is links to threads that are dated 2000 thru 2003 that doesn't come close to what I'm looking for.

I'm not sure if any of those links will get me started because they reference Excel 97, 98, & 2000. I am useing XP and we are set up with Outlook.

I guess what I am asking for is, does anybobdy have a link or some what of a code that will work with XP and Outlook, so maybe I can figure out what to do with this?

This is a snippet of what I have as a data base if it will help: ...

View 13 Replies View Related

Send A Mail

Dec 3, 2009

Step 1 - I have a Read Only excel template which I would fill with the required data.
Step 2 - The data in cell C8 (Text) should be taken as file name and should be Saved as file name.
Step 3 - The above saved as file should be attached to the mail to outlook. I would give the email address manually.

View 9 Replies View Related

Send Mail

Feb 15, 2007

I am using the following macro:

Sub SendActiveWorkbook()
ActiveSheet.SendMail _
Recipients:="Joeb@something.com", _
Subject:="Try Me " & Format( Date, "dd/mmm/yy")
End Sub

Is there another method I can use that will display the Email instead of just sending it?
Is there a method called DisplayMail?

View 4 Replies View Related

Send Mail To All In Range

Jul 23, 2014

I need a macro that will send a separate mail to each person in range (Data sheet), with body from Mail sheet of attached excel workbook.

For attached example it should send 5 mail, that have to be like : test mail.xlsx‎

View 14 Replies View Related

Send Mail Error

Jun 19, 2007

i use Excel 2007.............

The SendMail Method took it from OzGrid web does not work with me . It gives me an error msg : Method send mail of object workbook failed...........

Do i have to refrence 2 particular library. i use OP windos vista (windows mail)

Sub SendActiveWorkbook()
On Error Rsume Next
ActiveWorkbook.SendMail _
Recipients:="dump@ozgrid.com", _
Subject:="Try Me " & Format( Date, "dd/mmm/yy")
On Error Goto 0
End Sub

View 7 Replies View Related

Automatically Attach And Send By E-mail

Jan 16, 2009

In a generated workbook I have 2 e-mail adresses in seperate cells that I'd like the users to be able to easily send the workbook to.

One as the recipient and the other as cc.

So is it possible to either use a link or userform that takes both adresses and automatically attaches this workbook?

View 13 Replies View Related

Send Mail To Filtered People?

Feb 5, 2012

I have an excel workbook which is a result of a sports survey I conducted. It basically shows who likes which sport, what level they're at, preferred time of play, etc, and their email address.

A colleague has created a type of form (using formulas, not VBA) wherein you select your criteria (Sport, Gender, Level etc) and it displays the matching names.

What I'd like is to be able to select, via a check box or similar, 1 or more names from the list of results for that sport, click a button, and their addresses automatically open in a new Outlook mail window for the person to send a mail to those people.

View 4 Replies View Related

VBA Send Lotus Mail From Different Address

Oct 9, 2012

HTML Code:
'The procedure for executing the main task:
Sub Test2()
Dim noSession As Object, noDatabase As Object, noDocument As Object

[Code]....

However I now have a requirement to send it from my Team mailbox - which I have access to

View 1 Replies View Related

Pop Up Or Auto Send E-mail If Value Is True

Oct 7, 2009

is it possible for Excel to generate a pop-up or auto send an e-mail when a value is true? I'm wanting to be notified on a lengthy spreadsheet either by e-mail or by pop-up when an item is within 90 days of its due date.

Something like:

IF(H2-90>=TODAY,SEND E-mail/generate pop-up code,"")

View 9 Replies View Related

VBA Code To Send Mail Automatically From Outlook

Feb 28, 2014

I need to send a mail on a daily basis from outlook at 6.00 pm.

Containing a shared link to particular mail I'd.

View 10 Replies View Related

Unable To Send Mail Using CDO (remote Server)

Feb 11, 2009

I have CDO set up on in an excel workbook contained on our network. We have been using the following code for well over a year. It works flawlessly on 12 of our 13 computers. I can send mail through Excel using the following code on my computer. But not on a particular computer. The user at that particular computer can't send mail through the CDO code from her computer but can from other computers.
This problem is definitely isolated to a computer. I had tech support un-install office, use a cleaning tool, then re-install office. The problem persists. Is there a particular setting on this computer that needs to be set that I am unaware of?
Here is the code...

View 3 Replies View Related

Send Mail With Attachment Of Csv With Unique Number

Jan 13, 2010

The file which I want to send as a CSV needs to be named in a certain way. It would be the contents of cell A2, then the date it was sent and the time. Here is my current code. How can I get it to pick up data from a cell and then add it to the list. Also, the list has to be one string, so for example, 23459 Cell A2, 1310 Date and 192859 would be time. So the renamed file would be named 234591310192859. Here is my code which may make what I'm saying a bit more into a bit more sense. Currently the name which is outputted is 'Name of Spreadsheet.xls 13-Jan-10 19-31-59'.

View 6 Replies View Related

Send Mail By Click On Command Button

Sep 8, 2009

I have a command button in my excel sheet, if I or my team person clicks on it, the same file has to go to my manager's mail ID from my or my team person's (who clicks) outlook.

View 9 Replies View Related

Timesheet: Send Out A Mail Template Everyweek To All The Department

May 23, 2006

I send out a mail template everyweek to all the dept. employees using outlook. I attach a excel sheet to the mail so the employees can type in their hours and then sent it back. Then i go in manually each sheet and copy the info in THE timesheet excel sheet and sent it to the HR. Any easy way automate this process? What id like is to send a mai lcontaining the excel sheet, the emlpoyees fill it and the data tranfers to a excel sheet...

View 2 Replies View Related

Search For File Locate User Send Mail

May 11, 2007

I need to build vb that will move threw a folder earch files this source folder will be s:dc eports there will be multiple types of files. If the file ends with .ERR and the file size is > 0.1 KB THEN take file and open it then find the user id this will be 6 didgets .. this then needs to be located(if u look at attached spreadsheet “CTR208088.ERR” and go too column “AB” you will see “FA2 INPUT BY:311752 CODE) and then take and match THIS CODE (311752) to a workbook called “cashfrontieradmin11” there will be a “user name” column ‘A” in a “input names” tab and next to it column “B” “ full name” it will then register name and attach an email to user saying they have error “processing idx file into hiport”.

It will then attach error file to email and send to appropriate user(that is written in error log ) Example file is here ..the only issue I guess is being able to read the character placing(user id) in the message file..to pick this up and map back to admin file I will attach both files

View 5 Replies View Related

Send Mail Through Outlook To Team Members For Their Pending Trainings?

Jan 5, 2014

I am using an excel where I want to send mail to my team members for their trainings pendings,

Few trainings are once in a year and few traings are monthly.

View 1 Replies View Related

VBA Send Mail With Lotus Notes Attach ONLY With Worksheet Not Workbook

Apr 22, 2013

I am using a version of the following code that sends a mail using Lotus notes and attaches the Workbook - I am wondering if there is anyway I can make it attach the WORKSHEET instead ?

Code:
'The procedure for executing the main task:
Sub SendWithLotus()
Dim noSession As Object, noDatabase As Object, noDocument As Object
Dim obAttachment As Object, EmbedObject As Object
Dim stSubject As Variant, stAttachment As String
Dim vaRecipient As Variant, vaMsg As Variant

[code]...

View 1 Replies View Related

Send Mail On Outlook Based On Number Of Days Left To Deadline?

Jun 28, 2014

I have an excel sheet with one column containing deadline dates. I want the excel sheet to take each day's date and subtract it from the deadline date. If number of days left is less than 60. Send a mail via outlook to the email against that column.

View 3 Replies View Related

Mail Merge In Word And Then Copy / Paste Into Outlook Message And Send It Out

Jul 6, 2012

I have a spreadsheet with client names, email addresses, and appointment info. I export a .csv file from outlook. I have been doing a mail merge in word and then coping and pasting into an Outlook message and sending it out. I did some reseach and found code that I have made changes to. Of course they it doesn't work. I can't get anything to happen when I run this code.

Code:
Sub Qualls_Email_Confirms()

Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range

Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")

[Code] .........

View 3 Replies View Related

Macro To Send Mail Via Lotus Notes Diff Recipients With Range?

May 22, 2013

Am trying for a code which will send mail to recipients mentioned in column A [to] Coulmn B [CC] & formatted range should be pasted as body of email lets say C:F. Each time formatted header should remain same is it will contain column heading. I have a code which sends mail to specified recipients mentioned in code .

Code:

Sub Send_Formatted_Range_Data() Dim oWorkSpace As Object, oUIDoc As Object Dim rnBody As Range Dim lnRetVal As Long Dim WB6 As Workbook Set WB6 = Application.Workbooks.Open("C:TESTDaily_BKG.XLS") Const stTo As String =

[Code]....

View 3 Replies View Related

Excel 2010 :: Macro To Send Email Now Fails With Runtime Error 1004 - Mail System Failure

Aug 23, 2012

I've been using a macro successfully for the last couple of years, but this morning when I went to use it, it decided to fail. I have a workbook which contains various spreadsheets. The macro that has failed performs the following tasks:

1. It copies a list of email addresss from an external workbook to a sheet in the current workbook (still works)
2. It copies the referral sheet I want to send to a new file, and saves it with an appropriate filename to an appropriate folder (still works)
3. The macro then creates an email with a standard subject line, attaches the new worksheet and emails it to each of the addresses as above (broken)

The error message is from Microsoft Visual Basic. "Run-time error '1004': Mail system failure. Check your mail installation."

I'm guessing there is a setting somewhere in Excel that has changed as part of an update.

I've been through a number of the options in the developer menu to remove any obvious restrictions (& reopened excel afterwards), but so far it hasn't resolved the problem.

For what it's worth, here is the macro code.

With Application
.EnableEvents = False
.ScreenUpdating = False
End With
Run "PullInSheet1"
Dim oldbook As String

[Code] .......

In case you're wondering about the pullinsheet code, I'll add it below - but I probably grabbed it from this forum a couple of years ago (like some of the above) & just made some changes.

Code:
Sub PullInSheet1()
Dim AreaAddress As String
'''''' Sheet11.UsedRange.Clear
Dim ClRange As String
ClRange = "= 'L:ADMINEMPLOY SERVICES" _

[Code] ........

There are a couple of things I've wanted to do to improve the macro, but I couldn't justify the need to spend time working it out (since writing spreadsheets isn't really my job). Since it's broken at the moment, I can...

1. I'd like to create a subject line that reflects the name of the person being referred. For some reason though, anything other than text in the cell reference caused an error for me. eg, I tried using concatenate to create my subject line, but it didn't work.

2. I'd like the copied sheet to contain all of the formatting of the original sheet. Presumably there is a paste option that will do this and I just picked the wrong one.

The mailsystem we use is Groupwise 8. I couldn't find any settings in that program that have been changed, or that I could change.

I should change the extension from xls to xlsx in the code since I'm using Excel 2010 (but changing it doesn't fix the problem).

View 4 Replies View Related

Mail Merge Settings For Sending Multiple Mail?

Sep 14, 2012

We need to send multiple mail with attachment with outlook 2007 with option "Resend this message", now we want to use excel for sending the mail.

procedure.----------------------------------------------------------------------------------------------------
S.No. To cc----------------------------------------------------------------------------------------------------
1. xyz@ymail.com----------------------------------------------------------------------------------------------------
2. abc@gmail.com hursh@rediffmail.com, hursh@rediffmail.com, hursh@rediffmail.com, raj@hotmail.com----------------------------------------------------------------------------------------------------
3. ram@ymail.com ramesh@gmail.com---------------------------------------------------------------------------------------------------- 4. rajesh@ymail.com----------------------------------------------------------------------------------------------------
5. raghu@ymail.com raju@hotmail.com ---------------------------------------------------------------------------------------------------- 6. info@ymail.com----------------------------------------------------------------------------------------------------
7. ranjit@excel.com xyx@gmail.com----------------------------------------------------------------------------------------------------and

we have two files for attaching on desktop, one is a excel file and second is a zip file. we want to send the mail with excel mail merge.

View 1 Replies View Related

E-mail Worksheet For Various E-mail Clients

Nov 11, 2009

I have a workbook that has multiple worksheets and I would like to use a command button to e-mail just one selected sheet. I want to create the single sheet as an attachment on a new e-mail message but leave the addressing to the user as it will vary, and not save the single sheet. My challenge is that the users have a variety of different e-mail clients (Outlook, Lotus Notes and others).

View 2 Replies View Related

Enable Macro Automatically - Then Send Send Email

Sep 7, 2008

I used Scheduled Task to set up my spreadsheet to open daily. I have the code with assistance to pull out the due date items and place them into an email.

I have come across XLSTART/AUTOEXEC/ACTIVATE...ETC...
But cannot figure out the code that will automatically "enabling macro" once Scheduled Task opens the spreadsheet?

Then once the macro runs, the email with the due dates, how can this auto send without user interaction?
(currently I would have to hit send)

I am trying to make the process totally automated to open the spreadsheet at a certain time, send the email with due dates and close the spreadsheet.

Following code in ThisWorkbook--

Private Sub Workbook_Open()
Check_Date_Send_Mail
End Sub
Code in Module1--

Option Explicit
Sub Check_Date_Send_Mail()
Dim wbBook As Workbook
Dim wsSheet As Worksheet
Dim rnDate As Range, rnValue As Range
Dim stAddress As String, stMsg As String
Dim stRecipient As String, stSubject As String
Dim stPost As String
Set wbBook = ThisWorkbook
Set wsSheet = wbBook.Worksheets("Sheet1")
With wsSheet
Set rnDate = .Range("d2:t23")
End With

View 9 Replies View Related

Send Keys Doesn't Send Command

May 16, 2007

We use proprietary software to connect to an oracle database. The proprietary software has its own login form. I connect to 4 or 5 different databases randomly throughout the day. I wrote a script that I thought would alleviate my login woes but it doesn't work. The login, password, and database info get sent to the form but they all end up on the login line. Instead of the tab character being sent, I get a Beep generated for each line of code that is supposed to send the tab key code. My code is below and is stored in a *.vbs file.

setwshShell =wScript.CreateObject("WScript.Shell")
wshShell.AppActivate "Title Of My Login Form"
wScript.Sleep 100
wshShell.SendKeys "My Login Name"
wScript.Sleep 500
wshShell.SendKeys "{TAB}"
wScript.Sleep 500
wshShell.SendKeys "My Password"
wScript.Sleep 500
wshShell.SendKeys "{TAB}"
wScript.Sleep 500
wshShell.SendKeys "Name of My Database"
wScript.Sleep 500
wshShell.SendKeys "{TAB}"
wScript.Sleep 500
wshShell.SendKeys "~"

View 8 Replies View Related

Send Data From Userform To Worksheet AND Send Userform Fields In Email?

Jul 12, 2014

I have used a database template from this site and changed it to suit my needs but I have a bit of a problem with some of the code. I know how to update the worksheet with the relevant userform text fields and in another project I did I have successfully sent userform text fields in the body of an email.

For this project I want to update the worksheet AND send an email at the same time. However, using the two pieces of code together is causing an error that I can't seem to solve (using my very limited vba knowledge!). The code I am working on is below and I have highlighted the line that is getting the error message. C

VB:
Private Sub cmdSubmit_Click() 'Submit new record
Dim ws As Worksheet, lRow As Long, Str As String [code]....

View 1 Replies View Related

Mail With VBA

Dec 17, 2009

I have written a procedure to send out mails to a distribution list with the required attachment attached to the mails.

However, before the procedure (for sending mails) runs, I want to check if I am using the correct Outlook Mailbox to send the mails (my job requires me to use multiple mailboxes, and I cannot send out mail from a wrong mailbox; however, accidentally I may use wrong mailbox to send the mails).

So, I need the procedure to identify the correct mailbox.

View 18 Replies View Related

E-mail Range

Oct 8, 2007

I have finaly been able to put in words what I want to do. Hope this makes sense. I have the excel document should anyone want to see it.

In worksheet “Summary table”, column A is a job number (Txxx), that worksheet is a summary of all the jobs. If you select a job number and run a macro (lets call it macro5) it will then give you a detailed / itemized listing of the job in a separate worksheet. I already have created macro5 for the detailed bit. However now I am looking for a macro that will lookup the email address in worksheet “Tenacity jobs” corresponding to that job number and then email the result of macro 5 to the user.

So, for example, I begin in worksheet “Summary table” I would like to see the details on job # T456 which has a subtotal of 420,227.05. I click on this and it runs macro5 showing me the detailed breakdown. However once that macro has run I would then like to email this off to; cha@velocity.com; laur@velocity.com as they are the contact people which corresponds to #T456 in worksheet “Tenacity jobs”

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved