Send Multiple Emails From Excel

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 พ.ย. 2024

ความคิดเห็น • 177

  • @oneroadgoodwalk
    @oneroadgoodwalk 7 หลายเดือนก่อน +1

    great video, thanks for sharing!

  • @ravenrinas
    @ravenrinas วันที่ผ่านมา

    Great video - just fyi to other users: this doesn't seem to work on a Mac, we are missing the Outlook Object Library.

  • @erinsaunders9796
    @erinsaunders9796 6 หลายเดือนก่อน +1

    You just saved me an hour of work every month for the foreseeable future. Thank you!

  • @tristancills6442
    @tristancills6442 หลายเดือนก่อน

    THANKS!! Very helpful. You have secured my continued employment for the foreseeable future 😄

  • @zeynepe.5587
    @zeynepe.5587 10 หลายเดือนก่อน +1

    Very useful, thank you for the clear explanation!

  • @flance4011
    @flance4011 4 หลายเดือนก่อน +1

    Works perfectly. Thx. Is it possile to insert the signature stored in outlook?

    • @ExcelMacroMania
      @ExcelMacroMania  4 หลายเดือนก่อน

      Yes, you can do that if you first display the email body to get the signature as HTMLBody and then concatenate that with the body you want to add, all as HTMLbody - see below:

      With OutMail
      .Display
      signature = .HTMLBody
      .To = "recipientemail@outlook.com"
      .Subject = "email subject"
      body = "Dear Customer,... bla bla"
      .HTMLBody = body & signature
      '.Send 'uncomment to send
      End With

  • @rial.3912
    @rial.3912 ปีที่แล้ว +2

    This is very helpful. Thank you so much. Just want to ask how send the email to filtered recepients? Your help is very much appreciated.

    • @ExcelMacroMania
      @ExcelMacroMania  ปีที่แล้ว +1

      You need a loop through rows with visible cells only (skip entry.Row = 1 if you have headers), and put the send email macro inside the loop:
      For Each entry In ActiveSheet.UsedRange.SpecialCells(xlCellTypeVisible).Rows
      If entry.Row>1 Then
      email = Cells(entry.Row, 2).Value
      'here the other macro -------------------------------------------------------------------
      End If
      Next entry

    • @rial.3912
      @rial.3912 ปีที่แล้ว

      @@ExcelMacroMania thank you so much. I will try this one 😊

    • @janinehadia3036
      @janinehadia3036 หลายเดือนก่อน

      hi, thank you for this wonderful tutorial, i just want to know how about sending this email from other email address exept my personal mail, like groupmailbox? do i have to sign in to my groupmail box to send this? or is there any other way to lessen efforts? your response is much appreciated. thank you!

  • @ONESHOT007YT
    @ONESHOT007YT 5 หลายเดือนก่อน +1

    You're a gem of a kind❤

  • @juancarlosmontoya-acosta9588
    @juancarlosmontoya-acosta9588 3 หลายเดือนก่อน

    Excellent video!!!!! Following. Question, how do you change the font style and size of the email body?

    • @ExcelMacroMania
      @ExcelMacroMania  3 หลายเดือนก่อน

      You will have to use HTMLBody along html/css formatting. You can do it just with html as follows:
      OutMail.HTMLBody = ""This is a test email"

  • @mariamina4340
    @mariamina4340 ปีที่แล้ว +1

    Hi Thanks for the code. Can i add a button next to each recipient in order to send email when needed? Not always need to send all emails to all recipients.thanks again

    • @ExcelMacroMania
      @ExcelMacroMania  ปีที่แล้ว

      You can check how to add buttons to each row in this other video: th-cam.com/video/jHd3UI4hi8Y/w-d-xo.htmlsi=Hnoh6cIBz6PcrMWd
      The video shows a first macro to add the buttons linked to each row and run a second macro when clicked. You just need to replace the second macro with the "sending email" macro instead of the "delete row" covered in that other video. Good luck!

    • @mariamina4340
      @mariamina4340 ปีที่แล้ว

      Thanks. Can i also change sender email. I want to send from companies email instead of personal.

    • @ExcelMacroMania
      @ExcelMacroMania  ปีที่แล้ว +1

      @@mariamina4340 OutMail.SendUsingAccount = OutApp.Session.Accounts("emailaddress@yourdomain.com")

    • @mariamina4340
      @mariamina4340 ปีที่แล้ว

      @@ExcelMacroMania thank you very much. You are really helpful. How should i modify email send code in order to sign to each button an email?thanks

    • @ExcelMacroMania
      @ExcelMacroMania  ปีที่แล้ว +1

      @@mariamina4340 Check the code in this post: excelmacroclass.blogspot.com/2022/02/add-buttons-to-delete-rows.html
      Just rename the second macro and replace the last line (Rows.Delete...) with the send email macro. The variable target is the recipients email, so just change the column P to whatever column is your email, and the other properties (subject, body, etc) for that row.

  • @NoorSuziana-l2u
    @NoorSuziana-l2u 4 หลายเดือนก่อน

    Very interesting, thanks for sharing. Looking for this method.. Will try later. However, how to attached different file for each individu?

    • @ExcelMacroMania
      @ExcelMacroMania  3 หลายเดือนก่อน

      You just need to refer to the row where you have the location of the attachment, so instead of referencing a single cell, you target each row as follows supposing you have the attachment location in column F and loop by row with r.
      OutMail.Attachments.Add Range("F" & r).Value

  • @tzerocs
    @tzerocs 4 หลายเดือนก่อน

    Thank you for the tutorial, the code worked flawlessly.
    I have an issue where our organisation added an extra step before sending emails that is "Azure information protection" requiring us to select a leabel before proceeding.
    Is there a way to code it so that it selects one of them for each row ? I understand that i may somehow get a label ID and define "sensitivity" but im clueless.

    • @ExcelMacroMania
      @ExcelMacroMania  3 หลายเดือนก่อน

      I don't think you can change that with VBA. But indeed there is a "Sensitivity" property that allows to set the sensitivity of the email as normal, personal, confidential, or private, however, I don't believe is linked to your company's labels.

  • @martinespina3234
    @martinespina3234 3 หลายเดือนก่อน

    Hi, thanks for the video! Is there a way to make it so the emails go into the drafts folder in outlook or into a folder on desktop? I need to review the emails before sending them. Thanks!

    • @ExcelMacroMania
      @ExcelMacroMania  3 หลายเดือนก่อน

      Well, you can use "Display" instead of "Send" as I did in the video to see the email and then click "Send". You can also use "Save" instead of "Send" or "Display" and it will save it to the folder so that you can review the email or emails.
      OutMail.Display
      or
      OutMail.Save
      or
      OutMail.SaveAs = "xxxx" ... to specify the location (saves as .msg in the given location within your drive I believe)

  • @SantoshVishwakarma25
    @SantoshVishwakarma25 5 หลายเดือนก่อน +1

    Thank you very much, this is really Very helpful.

  • @mq5697
    @mq5697 ปีที่แล้ว +1

    Man this is fantastic, it is really useful method.
    Thank you for your efforts and keep up.

  • @MarcoYolofrimig
    @MarcoYolofrimig 6 หลายเดือนก่อน +1

    very good and helpful video! thank you!

  • @sandyhaniekaputra7532
    @sandyhaniekaputra7532 ปีที่แล้ว +1

    hello thanks for the video I wanna ask,
    How I add CC email what lines i need to add?
    thanks

    • @ExcelMacroMania
      @ExcelMacroMania  ปีที่แล้ว

      OutMail.CC = "emailaddress@domain.com"
      (and the same for BCC if needed)

  • @nazimkm
    @nazimkm 6 หลายเดือนก่อน

    Thank you for the Video!! Really helpful and much appreciated ❤
    Is there any way I can define from email ID please

    • @ExcelMacroMania
      @ExcelMacroMania  6 หลายเดือนก่อน +1

      What exactly do you want to define? When you say email ID, do you mean email address?

    • @nazimkm
      @nazimkm 6 หลายเดือนก่อน

      I have more than one email address in my outlook application. May I know the code to choose ‘from’ email ID .

    • @ExcelMacroMania
      @ExcelMacroMania  6 หลายเดือนก่อน +1

      @@nazimkm OutMail.SendUsingAccount = OutApp.Session.Accounts("youremail@outlook.com")

    • @nazimkm
      @nazimkm 6 หลายเดือนก่อน

      @@ExcelMacroMania I tried this, but did not work. Where exactly I should add this code? Also, Can you tell us how to add ‘from’ for each email separately from excel

    • @ExcelMacroMania
      @ExcelMacroMania  6 หลายเดือนก่อน

      @@nazimkm You need to put it inside the loop, at the end, and instead of the Send function. You need to define OutApp and OutMail before. Check how to define those in this post: excelmacroclass.blogspot.com/2023/05/send-multiple-emails-from-excel-vba.html
      There is no "From" method, you need to use SendUsingAccount with the corresponding email account as explained earlier. Good luck!

  • @Mentagor
    @Mentagor 7 หลายเดือนก่อน +1

    Nice job! Is it possible to use the signature allready saved in outlook? I have a company-signature with a logo i like to use with my mails

    • @ExcelMacroMania
      @ExcelMacroMania  7 หลายเดือนก่อน +1

      Yes, you can do that if you first display the email body to get the signature as HTMLBody and then concatenate that with the body you want to add, all as HTMLbody - see below:
      With OutMail
      .Display
      signature = .HTMLBody
      .To = "recipientemail@outlook.com"
      .Subject = "email subject"
      body = "Dear Customer,... bla bla"
      .HTMLBody = body & signature
      '.Send 'uncomment to send
      End With

  • @js13678
    @js13678 10 หลายเดือนก่อน

    Hello, thank you for your help! I have emails with duplicate subjects where I only want to generate 1 email for each subject. Can you tell me how I can alter the code to help with that?

    • @ExcelMacroMania
      @ExcelMacroMania  10 หลายเดือนก่อน

      I think you don't need to alter the code, just the arrangement in the worksheet. Put all emails separated by semi-colon together for the email and subject you want to send. Or, if you mean to send various emails to various recipients but with the same subject refer to always the same cell, for example: OutMail.Subject = Range("D2").Value

  • @איוויקסשירותיהנדסהפיקוחוייעוץ
    @איוויקסשירותיהנדסהפיקוחוייעוץ 4 หลายเดือนก่อน

    Thanks for the excellent tutorial. If my table contains, for example, 50 recipients, but currently through filtering it is required to send to only 8 recipients scattered in different and non-consecutive rows in the table (the other rows "disappear" temporarily in the filtering), is the loop you presented still correct to use? Will the Ir automatically skip those lines that were hidden in the filter or is another setting required?

    • @ExcelMacroMania
      @ExcelMacroMania  4 หลายเดือนก่อน

      You can use the same loop and a condition to check if the row is hidden or use a for each loop along special cells:
      For Each sheetRow In ActiveSheet.UsedRange.SpecialCells(xlCellTypeVisible).Rows
      ...
      Next sheetRow

    • @איוויקסשירותיהנדסהפיקוחוייעוץ
      @איוויקסשירותיהנדסהפיקוחוייעוץ 3 หลายเดือนก่อน

      I tried to run the code and got a message something like time error 1004.
      I checked the debug and the row:
      Lastrow= Cells (Rows.Count, “P”) .End(xlUp) .Row
      Has been flashed.
      What does it mean?

    • @ExcelMacroMania
      @ExcelMacroMania  3 หลายเดือนก่อน

      @@איוויקסשירותיהנדסהפיקוחוייעוץ May you declared "Lastrow" as Integer and your sheet has more than 32000 rows, so you need to declare it as Long instead.

    • @איוויקסשירותיהנדסהפיקוחוייעוץ
      @איוויקסשירותיהנדסהפיקוחוייעוץ 3 หลายเดือนก่อน

      Thanks.
      Now, if the last row is not known since I’m sorting the “To” column before clicking the SEND button, do I still use the command:
      For r=2 to last row?
      Do I still use:
      LastRow = Cells(Rows.Count, "B").End(xlUp).Row?
      You suggest me to add in the loop a command for searching a visible cells.
      1. I’m confused
      2. Is your suggestion replace the original command or it comes in addition?
      3. If in addition where do I position the new command? In the loop or not? What is the exact command?

    • @ExcelMacroMania
      @ExcelMacroMania  3 หลายเดือนก่อน

      @@איוויקסשירותיהנדסהפיקוחוייעוץ You can put it outside the loop if you filter once and then loop through each of the rows that have been filter. You can get the last row after filtering in many different ways,... one could be as follows (there is probably and easier way but this is the first thing that came now to my mind):
      LastRow = ActiveSheet.UsedRange.SpecialCells(xlCellTypeVisible).SpecialCells(xlCellTypeLastCell).Row

  • @liginrag5788
    @liginrag5788 22 วันที่ผ่านมา

    I need to attached each attachments to each email ID. How to do it Sir

  • @alejandrawitherspoon7887
    @alejandrawitherspoon7887 11 หลายเดือนก่อน

    Hi... this video was super helpful. I do have a question though. Is there a way to have the email come out of a different mailbox?

    • @ExcelMacroMania
      @ExcelMacroMania  11 หลายเดือนก่อน

      OutMail.SendUsingAccount = OutApp.Session.Accounts("yourotheraccount@outlook.com")

    • @andrewnessim3675
      @andrewnessim3675 10 หลายเดือนก่อน

      @@ExcelMacroMania Hi, where do I paste this within the code please?

    • @ExcelMacroMania
      @ExcelMacroMania  10 หลายเดือนก่อน

      @@andrewnessim3675 Somewhere after defining OutMail of course, maybe after OutMail.Subject,... .Body, etc, but BEFORE OutMail.Send.

  • @gabrielerickrasmana7563
    @gabrielerickrasmana7563 2 หลายเดือนก่อน

    Is it possible if the signature using currently email signature that has been set, because the signature has a picture and gif inside?
    And, How to do that?
    Kindly need your tips
    Thank you

  • @bosmail-x9c
    @bosmail-x9c ปีที่แล้ว

    How should I add a code for automatic submission? I want all emails gone when I run.
    Thank you for your help

    • @ExcelMacroMania
      @ExcelMacroMania  ปีที่แล้ว

      If you refer to scheduling the submission, here's an example to send the email at 13:00 today (email stays in the Outbox until delivery):
      OutMail.DeferredDeliveryTime = "5/22/2023 13:00"
      You can also use DateAdd function to send after a number of seconds, minutes, hours, days,..., this other example sends after 10 minutes from now (use "s" for seconds, "n" for minutes, "h" for hours, "d" for days, "m" for months)
      OutMail.DeferredDeliveryTime = DateAdd("n", 10, Now)

  • @TreyJ34
    @TreyJ34 29 วันที่ผ่านมา

    My issues is very simple and hopefully easy to address... I am just trying to send one email to multiple people however, when I type in an email then use : to seperate, it doesnt work. I get an error. It says Outlook doesnt recognize one or more names. I have two test emails Im using and when I only use one it works. Both of them work on their own but together it doenst work. Please help!

  • @younghussla3032
    @younghussla3032 11 หลายเดือนก่อน

    Hi thank you for the video. I am trying to send to multiple recipients but I do not have the emails in a single cell, they're distributed down my column B. But I also do not want to select the entire column B as I have multiple chunks of emails for different groups. How could I write a code to allow for this? Thanks!

    • @ExcelMacroMania
      @ExcelMacroMania  11 หลายเดือนก่อน +1

      You should probably concatenate the values in those cells with one of these two methods (first is simple loop, but second is better and shorter) for an example of have your emails in cells from B4 to B8.
      Dim recipients As String
      For Each cell In Range("B4:B8")
      recipients = recipients & cell.Value & ";"
      Next
      or simply
      recipients = Join(Application.Transpose(Range("B4:B8").Value), ";")

    • @younghussla3032
      @younghussla3032 11 หลายเดือนก่อน

      @ExcelMacroMania okay this worked! I'm not sure if you've encountered this but at first, all the emails populate in Outlook as expected, separated by semicolons (which is what we wanted), but then a few seconds later, outlook seems to clear a couple of the emails out when it does its profile search (which shows you the little dot beside their names like active/away status). Very odd. Wondering what's causing that. All emails are valid and the issue does not happen when manually copying and pasting the email list into Outlook. Thanks!

    • @ExcelMacroMania
      @ExcelMacroMania  11 หลายเดือนก่อน

      @@younghussla3032 Glad it worked! And the other thing you mentioned never happened to me, odd indeed. It may be due to settings, policies, etc? I don't really know and cannot think of any workaround.

  • @quarantineexpress2539
    @quarantineexpress2539 7 หลายเดือนก่อน

    Can we select multiple range for bodymain and is there way i can add table to the mail?

    • @ExcelMacroMania
      @ExcelMacroMania  7 หลายเดือนก่อน

      Sure, you can. If you want to add the range as a table in the email body you need to convert the table first to HTML and then use OutMail.HTMLBody instead of .Body. Here's how you convert a range to HTML table: th-cam.com/video/Ifc2I6wmWIk/w-d-xo.htmlsi=ZxSu-2k6Go4r9dcd

  • @UsmanAli-fs3jo
    @UsmanAli-fs3jo 3 หลายเดือนก่อน

    Hi, I just want to know is it possible to send multiple email with different attachment to multiple recipients?

    • @ExcelMacroMania
      @ExcelMacroMania  3 หลายเดือนก่อน

      Of course it is. Add the location to each attachment in each row (in column F in this example) and then refer to that cell while looping through rows as you target each individual email or subject, for example as shown below:
      OutMail.Attachments.Add Range("F" & r).Value

  • @furiouspenguin1448
    @furiouspenguin1448 2 หลายเดือนก่อน

    Does this also work on gmail?

  • @Муатдиб-в9ь
    @Муатдиб-в9ь 8 หลายเดือนก่อน

    And how to add the hyperlink to the body of the e-mail, same hyperlink from specific cell or different for each recipient

    • @ExcelMacroMania
      @ExcelMacroMania  8 หลายเดือนก่อน

      If you mean to add a hyperlink to the email body, you need to use HTMLBody as follows:
      You need to use OutMail.HTMLBody = ... and add HTML with 'a' tags along with 'href'. For example ...

  • @hamzayasin4856
    @hamzayasin4856 11 หลายเดือนก่อน

    Can this macro be used after modification for Gmail ? please let me know

    • @ExcelMacroMania
      @ExcelMacroMania  11 หลายเดือนก่อน

      If you add your gmail account to Outlook, you can still use this method to send an email from google account adding this to the code:
      OutMail.SendUsingAccount = OutApp.Session.Accounts("youremail@gmail.com")
      If you cannot or don't want to add gmail to Outlook there are a couple of other methods. I will cover everything in another video soon.

  • @prabhasarts3737
    @prabhasarts3737 2 หลายเดือนก่อน

    How you have created sent button

  • @camspider9887
    @camspider9887 9 หลายเดือนก่อน

    what if i have a .msg template and want to do ur method, regarding that that msg template file is in html and has multible attachment

    • @ExcelMacroMania
      @ExcelMacroMania  9 หลายเดือนก่อน +1

      You need to create item from template when you define the mail item (OutMail) referring to the email template (usually a .oft file rather than .msg that you have) in your system - see an example below:
      Set OutMail = OutApp.CreateItemFromTemplate("C:\Users\Administrator\Templates\template1.oft")

  • @idealfaizan7804
    @idealfaizan7804 ปีที่แล้ว

    Hi There,
    thank you for your work and providing free learning resources. however i want to point out an error in the multiple email sending macro. In this macro, the email is taking the first attachment only. and not as per the sheet.
    Can you please let us know how to fix this issue. Link is below
    Excel Macro Class: Send Multiple Emails From Excel VBA Macro
    Thanks & Regards,
    Faizan

    • @ExcelMacroMania
      @ExcelMacroMania  ปีที่แล้ว

      Thanks for highlighting your concern. I am afraid to tell you that what you mention is NOT an error in the macro at all. As explained in the video, if you want to send different attachments (instead of always the same attachmend, same subject, etc), you need to refer to the cell in the sheet with that information. For example, if you have the attachment file path in column F and you loop through rows incrementing the value of a row counter r, you would use the following:
      OutMail.Attachments.Add Range("F" & r).Value
      That's explained in the video around the minute 8, please check again if it's not clear yet.

    • @idealfaizan7804
      @idealfaizan7804 ปีที่แล้ว

      @@ExcelMacroMania thank you
      Yes. You are correct.
      Already replied you on email about my problem.

  • @xmm424x
    @xmm424x 6 หลายเดือนก่อน

    Is there a way to have the range() come up as a hyperlink in the email? Say the cell values in column D are URLs, so I do range(“D” & r).value and I run the macro, I want the URL to appear as a clickable link in the email . Is that possible?

    • @ExcelMacroMania
      @ExcelMacroMania  6 หลายเดือนก่อน +1

      Yes, you can do that inserting the body as HTML and adding tags with hyperlinks. For example:
      OutMail.HTMLBody = "Follow Link"

  • @AshleyCallaway-y2s
    @AshleyCallaway-y2s 3 หลายเดือนก่อน

    Great video. But, unfortunately, when I click the button, nothing happens. I don't get any errors, just nothing. When I open the VBA editor, and press play nothing happens either. what should I do?

    • @ExcelMacroMania
      @ExcelMacroMania  3 หลายเดือนก่อน

      Do you have a "Send" "Display" function in the code? Did you add the Outlook library to the references? Or, maybe you have some restrictions to run macros or send email in your system (policies, etc). Check the code here: excelmacroclass.blogspot.com/2023/05/send-multiple-emails-from-excel-vba.html

  • @NatWee-f4m
    @NatWee-f4m ปีที่แล้ว

    Hi, many thanks for the tutorial!
    1. I have a problem when I run the code, it says to debug the line .display ?
    2. May I know how I can add the big send button on the sheet to run the code?
    Thank you!

    • @ExcelMacroMania
      @ExcelMacroMania  ปีที่แล้ว

      1. I don't why that happens, maybe it has something to do with your office package, outlook and excel not in sync (different versions or something like that). I am just thinking out loud. I wonder if it sends the email (if it cannot display probably cannot send). Please double-check the code, you can find it in my blog: excelmacroclass.blogspot.com/2023/05/send-multiple-emails-from-excel-vba.html
      2. This video shows how to add a button to the sheet and assign a macro to it: th-cam.com/video/t4916enC11I/w-d-xo.htmlsi=PBXZRB2zqDZItcr2

    • @ExcelMacroMania
      @ExcelMacroMania  ปีที่แล้ว

      A small correction on point 2 (add button). That video shows you how to add it programatically with VBA, but you probably just want to add one button manually. In that case, you go to the Developer tab in the ribbon (if you don't have it, right-click to customize the ribbon and add the developer tab), and then you go to insert, under controls, and insert a command button form control - it will prompt a dialog to select the macro that you want to run when clicking the button. If it doesn't prompt, you simply right-click the button and choose to assign macro.

  • @hiteshrajain9810
    @hiteshrajain9810 5 หลายเดือนก่อน

    Hey, thank you very much, when I run the macro it starts loading and after 10-15 secs, it shows “Run-time error” Server execution failed. If anyone can help?

    • @ExcelMacroMania
      @ExcelMacroMania  5 หลายเดือนก่อน

      Uhmm.. that's weird. Please check the code here and make sure is correct: excelmacroclass.blogspot.com/2023/05/send-multiple-emails-from-excel-vba.html

  • @prakashaditya24
    @prakashaditya24 22 วันที่ผ่านมา

    License information for this component not found. You don't have an appropriate license to use this functionality in the design environment
    Pls help

  • @deveshkrishnabissa4529
    @deveshkrishnabissa4529 2 หลายเดือนก่อน

    great & useful video but when i click run its showing old outlook & asking me to add account , i am now using new version of the same , can you please help me get out of this

    • @ExcelMacroMania
      @ExcelMacroMania  2 หลายเดือนก่อน

      It does not work with online version, maybe that's why.

    • @deveshkrishnabissa4529
      @deveshkrishnabissa4529 2 หลายเดือนก่อน

      Thanks for your reply
      I am using new version and I also have subscription of the same can you help me when I click on send mail its showings add account but it's not working

  • @CiaraHarlin
    @CiaraHarlin 8 หลายเดือนก่อน

    Hello, is it possible to add in your signature automatically within the VBA code?

    • @ExcelMacroMania
      @ExcelMacroMania  8 หลายเดือนก่อน

      Yes, you can do something like this:
      With OutMail
      .Display
      signature = .HTMLBody
      .To = "recipientemail@outlook.com"
      .Subject = "email subject"
      body = "Dear Customer,... bla bla"
      .HTMLBody = body & signature
      '.Send 'uncomment to send
      End With

    • @CiaraHarlin
      @CiaraHarlin 8 หลายเดือนก่อน +1

      @@ExcelMacroManiathanks v much!

  • @emilteh3448
    @emilteh3448 8 หลายเดือนก่อน

    If I want to add a rules like if there is “YES”word maintain in certain cell that email will send. If there is “No”word maintain in certain cell that email will not send out.
    For example row one I want to send out so I maintain Yes in certain cell.
    Row two and row there I don’t want to send out so I maintain No in certain cell.
    Please advise. Appreciate for your help

    • @ExcelMacroMania
      @ExcelMacroMania  8 หลายเดือนก่อน +1

      Let's say you have that info in column M, so you need to add inside the loop but before the Set OutMail.. and With OutMail, the following condition:
      If Range("M" & r).Value = "Yes" Then
      Set OutMail...
      With OutMail
      etc....
      End If

    • @emilteh3448
      @emilteh3448 8 หลายเดือนก่อน

      @@ExcelMacroMania thank you for quick reply. I just tried but it show complie error:End if without block if

    • @ExcelMacroMania
      @ExcelMacroMania  8 หลายเดือนก่อน

      @@emilteh3448 You probably forgot to add the "End If" at the end. Check again the code I wrote above, there's a If statement...and End If at the end.

  • @notadhominem4743
    @notadhominem4743 ปีที่แล้ว

    Hi, that was so helpful but I have 2 questions. When we run the program I don’t want to push the send button for each and every email in outlook, how can I do that?
    And I tested it all my emails are gone to spam box, how can I stop it?
    Thanks a lot :)

    • @ExcelMacroMania
      @ExcelMacroMania  ปีที่แล้ว +1

      1. You don't need to use the button, there are many other ways to run a macro. Have a look at this other video to see 10 different ways to run a macro: th-cam.com/video/4-YBIPL1gsc/w-d-xo.htmlsi=azqSsZJpGxSrhzdv
      2. This method is good to email your team members, work colleagues, friends, etc. When it comes to random email recipients, this or any other method/system will probably be block by anti-spam, because that's actually what you are trying to do. Spam filters have got very smart and can detect fraudulent emails. Your email address may have already been added to anti-spam DB, so any other way of sending multiple emails (or even just one individual email to a random person, although depends on the email provider/domain of that recipient), will eventually be blocked/labeled as spam.

    • @notadhominem4743
      @notadhominem4743 ปีที่แล้ว

      Thanks a lot thats perfect
      @@ExcelMacroMania

  • @arshinshaikh7006
    @arshinshaikh7006 7 หลายเดือนก่อน

    How can we bypass the external recipients message that we get in outlook via macro?

    • @ExcelMacroMania
      @ExcelMacroMania  7 หลายเดือนก่อน

      You need to setup that in Outlook under File->Options->Mail->MailTips

  • @shihanxd6448
    @shihanxd6448 ปีที่แล้ว

    hello, what if your email is repeated, isit possible to merge 2 email together including the data and not create 2 email at once.

    • @ExcelMacroMania
      @ExcelMacroMania  ปีที่แล้ว

      When you say "merge", you mean to merge the email body? If so, you can concatenate as much text (or HTML) as you want and send it to the same email recipient. For example:
      body1 = "This is the first paragraph or block of text in the email body"
      body2 = "Anything else here...."
      OutMail.Body = body1 & vbLf & vbLf & body2 & vbLf & vbLf & ...

  • @dayton-ke2in
    @dayton-ke2in ปีที่แล้ว

    How would I code it to allow for my existing email signature to display?

    • @ExcelMacroMania
      @ExcelMacroMania  ปีที่แล้ว

      I guess you mean to keep your default signature that is added automatically when creating a new email. That signature is part of the body, and is replaced with whatever you put in .Body = "bla bla...". So the trick is to first display and get the HTMLBody, which is just the default signature, and then concatenate that when adding the body, but as HTMLbody - see below:
      With OutMail
      .Display
      signature = .HTMLBody
      .To = "recipientemail@outlook.com"
      .Subject = "email subject"
      body = "Dear Customer,... bla bla"
      .HTMLBody = body & signature
      '.Send 'uncomment to send
      End With

  • @kimi4asahi
    @kimi4asahi 5 หลายเดือนก่อน +1

    Hi, I've tried running the code multiple times without the Display cuz I want to try sending it automatically but it's not sending. Sometimes it goes automatically to outbox. Why is that?

    • @ExcelMacroMania
      @ExcelMacroMania  5 หลายเดือนก่อน +1

      That's the normal behavior of Outlook. Emails go first to the Outbox folder and then to the Sent folder. It usually happens very fast and we do not even realize about it. As you are not automating with Excel, sending many emails takes longer and they may stay longer in the Outbox folder, but eventually should be all sent out. If that does not happen, you could add a short delay within the For loop to let your computer process everything. You can use the function Wait for that.

  • @jinx29211
    @jinx29211 ปีที่แล้ว +1

    how can I change one word in my email to a hyperlink ? I tried to create a seperate cell and concatenate it but it didnt translate to outlook. Is there a way to do it in VBA ?

    • @ExcelMacroMania
      @ExcelMacroMania  ปีที่แล้ว +2

      You need to use HTMLBody and add HTML with a tags along with href. For example ...

    • @Муатдиб-в9ь
      @Муатдиб-в9ь 8 หลายเดือนก่อน

      @@ExcelMacroMania also interested how to do this

    • @ExcelMacroMania
      @ExcelMacroMania  8 หลายเดือนก่อน

      @@Муатдиб-в9ь OutMail.HTMLBody = ""

  • @lorenzc811
    @lorenzc811 ปีที่แล้ว

    Hey New Subscriber here, this is perfect example of what I am looking for. My only problem is that how can I use an outlook template as the body of email?

    • @ExcelMacroMania
      @ExcelMacroMania  ปีที่แล้ว

      You need to create item from template when you define the mail item (OutMail) referring to the email template (.oft file) in your system - see an example below:
      Set OutMail = OutApp.CreateItemFromTemplate("C:\Users\Administrator\Templates\template1.oft")

    • @lorenzc811
      @lorenzc811 ปีที่แล้ว

      @@ExcelMacroMania thanks for your instructions nailed it the first time i did it. 💪🏻

    • @ExcelMacroMania
      @ExcelMacroMania  ปีที่แล้ว +1

      @@lorenzc811 Glad to know it worked out!

    • @lorenzc811
      @lorenzc811 ปีที่แล้ว

      @@ExcelMacroManiaHi sir, is there any way I can add details to the template using macro? For instance, how can I make a center header added in the template?🤔

    • @ExcelMacroMania
      @ExcelMacroMania  ปีที่แล้ว +1

      @@lorenzc811 You can edit the template body first saving the body to a string variable and then adding what you want with OutMail.Body or OutMail.HTMLBody (it's a 2-step process). To add your centered header you add these 2 lines:
      1. myTemplateBody = OutMail.Body or OutMail.HTMLBody
      2. OutMail.HTMLBody = "My header" & myTemplateBody

  • @mrutyunjaymallik7182
    @mrutyunjaymallik7182 4 หลายเดือนก่อน

    Can you please help to solve the error "Runtime error '429' ActiveX component cant create object"

    • @ExcelMacroMania
      @ExcelMacroMania  4 หลายเดือนก่อน

      Make sure you have added the Outlook library to references and you have properly declared/defined the objects. Check the code is correct here: excelmacroclass.blogspot.com/2023/05/send-multiple-emails-from-excel-vba.html

  • @mohanedalwhaibi576
    @mohanedalwhaibi576 5 หลายเดือนก่อน

    hi thanks for all this but how can i use another app than outlook like mail in windows 11

    • @ExcelMacroMania
      @ExcelMacroMania  5 หลายเดือนก่อน +1

      You can also send via Gmail, check out this other video: th-cam.com/video/T7G_EnKyS_0/w-d-xo.htmlsi=cH50psvDsP29qUZz

    • @mohanedalwhaibi576
      @mohanedalwhaibi576 5 หลายเดือนก่อน +1

      @@ExcelMacroMania Thanks very much i fixed that ❤

  • @kayeturnbull8241
    @kayeturnbull8241 ปีที่แล้ว

    How do I send multiple pdf attachments to one person.
    All how to send different attachments (monthly inovices) to different customers. Each customer email is emailed with one click?

    • @ExcelMacroMania
      @ExcelMacroMania  ปีที่แล้ว

      Just repeat that line as many times as needed. For example:
      With OutMail
      .Attachments.Add attachment1
      .Attachments.Add attachment2
      .Attachments.Add attachment3
      ...
      End With

  • @mohamedeid4090
    @mohamedeid4090 หลายเดือนก่อน +1

    I tried this solution but i think i got restrict. This message appear
    " This message couldn't be delivered because the sending email address was not recognized as a valid sender"

    • @cxoxoaz
      @cxoxoaz หลายเดือนก่อน

      OMG SAME!!

  • @monapanchal2609
    @monapanchal2609 7 หลายเดือนก่อน

    how to add picture in mail body within same code?

    • @ExcelMacroMania
      @ExcelMacroMania  7 หลายเดือนก่อน

      Add email body as HTML and embed an image in the HTML code, for example as follows:
      bodypic = ""
      OutMail.HTMLBody = body & bodypic

  • @likhithlicky2947
    @likhithlicky2947 ปีที่แล้ว

    Sir can we add multiple emails in "TO" Column.. Can you please explain that

    • @ExcelMacroMania
      @ExcelMacroMania  ปีที่แล้ว

      You can add as many emails as you want in the "TO" column, but they must be separated with a semi-colon (;)

  • @ahmetcankaplan3863
    @ahmetcankaplan3863 2 หลายเดือนก่อน

    What Should we do if we don't Attach an attachments to every Mail ?
    .Attachments.Add Range("G" & r).Value
    If Not attach "" Then
    .Attachments.Add (attach)
    End If

  • @prakashaditya24
    @prakashaditya24 22 วันที่ผ่านมา

    License information for this component not found. You don't have an appropriate license to use this functionality in the design environment
    This error is coming while running the macro

  • @husseinalani2684
    @husseinalani2684 วันที่ผ่านมา

    last row: Ir, is it

  • @ranim.g3514
    @ranim.g3514 2 หลายเดือนก่อน

    I want to send 40 emails in one go to carrier's need help

  • @ranjeetbaranwal1815
    @ranjeetbaranwal1815 8 หลายเดือนก่อน

    I am getting a pop up complie error user defined type not defined
    Can anyone let me know how to fix it

    • @ExcelMacroMania
      @ExcelMacroMania  8 หลายเดือนก่อน

      Looks like you didn't declare/define some object or variable... check the code here: excelmacroclass.blogspot.com/2021/12/send-email-from-excel.html

  • @Mr.Joker_317
    @Mr.Joker_317 6 หลายเดือนก่อน

    In subject we need table how to insert

    • @ExcelMacroMania
      @ExcelMacroMania  6 หลายเดือนก่อน

      You mean in body? If you want to add the range as a table in the email body you need to convert the table first to HTML and then use OutMail.HTMLBody instead of .Body. Here's how you convert a range to HTML table: th-cam.com/video/Ifc2I6wmWIk/w-d-xo.htmlsi=ZxSu-2k6Go4r9dcd

  • @maliktaha95
    @maliktaha95 3 หลายเดือนก่อน

    It says compile error user defined type not identified. Kidnly help

    • @ExcelMacroMania
      @ExcelMacroMania  3 หลายเดือนก่อน

      I believe you are mistyping some variable or function. Check the correct code here: excelmacroclass.blogspot.com/2023/05/send-multiple-emails-from-excel-vba.html

    • @maliktaha95
      @maliktaha95 2 หลายเดือนก่อน

      @@ExcelMacroMania Thankyou the code is working, however can you tell how can I use it through outlook web instead of application because my administrator only has allowed my outlook account to be used through the web. Kindly Help

    • @ExcelMacroMania
      @ExcelMacroMania  2 หลายเดือนก่อน +1

      @@maliktaha95 Unfortunately this does not work with the web version of Outlook.

  • @HarshilRajput-e3s
    @HarshilRajput-e3s 10 หลายเดือนก่อน

    I am trying but run time error and showing automation error & exception occurred Help for resolve this error

    • @ExcelMacroMania
      @ExcelMacroMania  10 หลายเดือนก่อน

      That sounds like your computer is running the code faster than emails are processed.... maybe you can try adding DoEvents before the loop or put a 1 second delay inside the For loop with Application.Wait.

  • @keyurpurabiarao8683
    @keyurpurabiarao8683 7 หลายเดือนก่อน

    Will it work for default signature?

    • @ExcelMacroMania
      @ExcelMacroMania  7 หลายเดือนก่อน

      Yes, but you need to display first to get the signature as HTML and then concatenate as follows:
      With OutMail
      .Display
      signature = .HTMLBody
      .To = "recipientemail@outlook.com"
      .Subject = "email subject"
      body = "Dear Customer,... bla bla"
      .HTMLBody = body & signature
      '.Send 'uncomment to send
      End With

  • @PeterTokarcik
    @PeterTokarcik 9 หลายเดือนก่อน

    I think there are two small mistakes.
    .Subject = Range("D" & r).Value
    bodyMain = Range("E" & r).Value
    ;-)

    • @ExcelMacroMania
      @ExcelMacroMania  9 หลายเดือนก่อน +1

      Thanks for the feedback, but you are wrong, it is NOT a mistake. I explained in the video that you can send various emails with the same subject and body, in which case we target D2 and E2 only, or if you want to send a different subject and body for each recipient then you target the respective row with Range("D" & r), etc. ;-)

  • @rahulrolling
    @rahulrolling 7 หลายเดือนก่อน

    When I am clicking on F5 then this is turning up in yellow color Sub SendMultipleEmails() and Compile Error: User-defined type not defined. Please solve

    • @ExcelMacroMania
      @ExcelMacroMania  7 หลายเดือนก่อน

      That's probably because you did not define some variable or function while writing the code. Have a look and compare with the code here: excelmacroclass.blogspot.com/2023/05/send-multiple-emails-from-excel-vba.html

    • @priyakalled745
      @priyakalled745 4 หลายเดือนก่อน

      @@ExcelMacroMania

  • @syedfaiyaz346
    @syedfaiyaz346 4 หลายเดือนก่อน

    9:31 compile error
    User- defined type not defined
    This error is coming

    • @ExcelMacroMania
      @ExcelMacroMania  4 หลายเดือนก่อน

      That's probably because you miss-typed some of the objects/variables. Check the correct code here: excelmacroclass.blogspot.com/2023/05/send-multiple-emails-from-excel-vba.html

  • @nayanjeetsinghdhadwal6142
    @nayanjeetsinghdhadwal6142 3 หลายเดือนก่อน

    Hi,
    It is not working for me, please help.

    • @ExcelMacroMania
      @ExcelMacroMania  3 หลายเดือนก่อน

      Make sure you have Outlook configured, add the Outlook library to Excel VBA project references, and the code is correct - check the code here: excelmacroclass.blogspot.com/2023/05/send-multiple-emails-from-excel-vba.html

    • @nayanjeetsinghdhadwal6142
      @nayanjeetsinghdhadwal6142 3 หลายเดือนก่อน

      @@ExcelMacroMania it worked, but I want to know if I use @CC it will allow me to add email addresses to CC of that email, correct? and how can I edit the fonts of the body of the email....

    • @ExcelMacroMania
      @ExcelMacroMania  3 หลายเดือนก่อน

      @@nayanjeetsinghdhadwal6142 Glad it worked. OutMail.CC will add the emails as carbon copy, yes. To update the font use HTMLBody along html with a given font or using CSS.

    • @nayanjeetsinghdhadwal6142
      @nayanjeetsinghdhadwal6142 3 หลายเดือนก่อน

      @@ExcelMacroMania didn’t understand any thing about the HTML and css, like you mentioned the body of the email in a column, how can we change the font or background colour of the text or change it into bold italic underline ?

    • @ExcelMacroMania
      @ExcelMacroMania  3 หลายเดือนก่อน

      @@nayanjeetsinghdhadwal6142 You need to learn the basics of HTML and CSS, please check online. Then you use HTMLbody to format the email body as you wish. For example, if you want to change the font size of a paragraph in the email you could do something like this:
      OutMail.HTMLbody = "This is a bigger paragraph."

  • @shivamharwalkar6815
    @shivamharwalkar6815 9 หลายเดือนก่อน

    Facing path file error

    • @ExcelMacroMania
      @ExcelMacroMania  9 หลายเดือนก่อน

      You mean path of the attachment, right? Do you have the attachment in your local drive? or may in OneDrive? It should start with C:\... for example C:\Users\username\Documents\..., so check that, for example with ActiveWorkbook.FullName. If it starts with .... it means is in OneDrive and you'll need to convert to local path.

  • @sarthakaganja8466
    @sarthakaganja8466 ปีที่แล้ว

    I sent my multiple emails from concept shown here but with different code lines. But my each and every messages is being delivered in spam folder with warning message" This message seems dangerous .Similar messages were used to steal people's personal information. Avoid clicking links, downloading attachments or replying with personal information" although I have got outlook account from my side , on the other side all recipent emails is in Gmail. Please help me out . Thankyou

    • @ExcelMacroMania
      @ExcelMacroMania  ปีที่แล้ว

      I feel your concern, but I don't think it has nothing to do with the "method" used to send the emails, and probably rather with the email account used. It does not really matter if you use a macro to send it or do it manually. I guess the problem comes when sending too many emails to the same recipient, or using an email account that is already "labeled" as spammer account, and such things, I guess.

  • @searchresearch7286
    @searchresearch7286 ปีที่แล้ว

    "User-defined type not defined" error

    • @ExcelMacroMania
      @ExcelMacroMania  ปีที่แล้ว

      Sounds like you've used some other function or type, maybe you've just miss-typed some variable or object and VBA cannot find it. Please check the code in the blog article, that should work well: excelmacroclass.blogspot.com/2023/05/send-multiple-emails-from-excel-vba.html

  • @himanshu23457
    @himanshu23457 ปีที่แล้ว

    Sir ,,When the mail is sent, the message 'Mail sent successfully' should automatically appear in the next column of the attachment
    Which code needs to be entered for this

    • @ExcelMacroMania
      @ExcelMacroMania  ปีที่แล้ว +1

      If the next column is H and row r:
      Range("H" & r).Value = "Message sent successfully"

    • @himanshu23457
      @himanshu23457 ปีที่แล้ว

      @@ExcelMacroMania Sir, if I delete the emails id from the To column (B), then the message sent successfully will also be automatically deleted from the H column. What will be the code for this

    • @ExcelMacroMania
      @ExcelMacroMania  ปีที่แล้ว

      @@himanshu23457 But why would you delete the email? The macro I discuss in this video does not delete anything. You keep the list of emails there, and if you want to track which email has been sent, you add that message in column H or any ohter.

  • @feliperodriguez8444
    @feliperodriguez8444 10 หลายเดือนก่อน

    How can you center the text through VBA?

    • @ExcelMacroMania
      @ExcelMacroMania  10 หลายเดือนก่อน

      You need to do it with HTML and use HTMLBody property. For example, you can put your email body inside a p tag that is aligned to the center as follows:
      emailBody = "This is a test email message aligned to the center"
      emailHTMLBody = "" & emailBody & ""
      OutMail.HTMLBody = emailHTMLBody