Computer >> कंप्यूटर >  >> सॉफ्टवेयर >> Office

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

लेख आपको स्वचालित रूप से ईमेल भेजने . के सर्वोत्तम संभव तरीके दिखाएगा तारीख . के आधार पर एक्सेल से . आमतौर पर, ईमेल . भेजना आसान होता है आउटलुक . से या जीमेल , लेकिन जब आप ईमेल send भेजना चाहते हैं किसी निश्चित समय या तारीख . पर , आप Microsoft Excel का प्रभावी ढंग से उपयोग कर सकते हैं।

डेटासेट में, हमारे पास कुछ ईमेल पते . हैं (admin@wsxdn.com . को छोड़कर वे सभी डमी पते हैं , जो मेरा है। मैं अपने पते का उपयोग कर रहा हूं ताकि मैं आपको बता सकूं कि तरीके कैसे काम करते हैं।

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

दिनांक के आधार पर Excel से स्वचालित रूप से ईमेल भेजने के 3 तरीके

1. एक निश्चित तिथि के आधार पर स्वचालित रूप से ईमेल भेजने के लिए एक्सेल वीबीए का उपयोग करना

हम एक ईमेल स्वचालित रूप से . भेज सकते हैं अनुप्रयोग के लिए Microsoft Visual Basic . का उपयोग करके (वीबीए ) तारीखों . के आधार पर . आप तिथियों . की सूची बना सकते हैं जब आप ईमेल भेजना चाहते हैं उनके संबंधित प्राप्तकर्ताओं के लिए। आइए बेहतर समझ के लिए नीचे दी गई प्रक्रिया से गुजरते हैं। इस खंड में, हम केवल तारीखों . के साथ काम करेंगे ।

चरण:

  • सबसे पहले, डेवलपर . पर जाएं>> विजुअल बेसिक 

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

  • फिर VBA विंडो खुलेगा। सम्मिलित करें . चुनें>> मॉड्यूल
  • तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजेंनिम्न कोड को VBA मॉड्यूल में टाइप करें ।
Sub SendEmail01()
Dim Range_Select As Range
Dim Date_Range As Range
Dim Cell_Address As String
Dim Subject, Email_From, Email_To, Cc, Bcc, Email_Text As String
Dim Email_Obj, Single_Mail As Object
On Error Resume Next
Cell_Address = ActiveWindow.RangeSelection.Address
Set Range_Select = Application.InputBox("Select a range:", _
"Message Box", Cell_Address, , , , , 8)
If Range_Select Is Nothing Then Exit Sub
For Each Date_Range In Range_Select
If Date_Range.Value = Date Then
Subject = Application.InputBox("Subject: ", "Message", , , , , , 2)
Email_From = Application.InputBox("Send from: ", "Message Box", , , , , , 2)
Email_To = Application.InputBox("Send to: ", "Message Box", , , , , , 2)
If Email_To = "" Then Exit Sub
Cc = Application.InputBox("CC: ", "Message Box", , , , , , 2)
Bcc = Application.InputBox("BCC: ", "Message Box", , , , , , 2)
Email_Text = Application.InputBox("Message Body: ", "Message Box", , , , , , 2)
Set Email_Obj = CreateObject("Outlook.Application")
Set Single_Mail = Email_Obj.CreateItem(0)
With Single_Mail
.Subject = Subject
.To = Email_To
.Cc = Cc
.Bcc = Bcc
.Body = Email_Text
.send
End With
End If
Next
End Sub

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

कोड स्पष्टीकरण

  • सबसे पहले, हमने कुछ आवश्यक चर घोषित किए:Range_Select और Date_Range श्रेणी . के रूप में; सेल_पता , विषय , ईमेल_प्रेषक , ईमेल_प्रति , प्रतिलिपि , गुप्त प्रति , ईमेल_पाठ स्ट्रिंग . के रूप में; Email_Obj और सिंगल_मेल वस्तु . के रूप में ।
  • फिर हम रेंज_सेलेक्ट . सेट करते हैं एक इनपुटबॉक्स . पर जहां यह एक श्रेणी . का चयन कर सकता है संदेश बॉक्स . के माध्यम से कक्षों की संख्या ।
  • उसके बाद, हम मान . का उपयोग करते हैं VBA IF स्टेटमेंट . में और विषय . भी सेट करें , ईमेल_प्रेषक और ईमेल_प्रति एक इनपुटबॉक्स . पर ।
  • अगर कोई ईमेल पता नहीं है (Email_To=“” ), उप प्रक्रिया बाहर निकलें . अन्यथा, हम एक नए IF Statement . में कुछ और वेरिएबल डालते हैं . प्रतिलिपि और गुप्त प्रति कार्बन कॉपी . का संदर्भ लें और ब्लाइंड कार्बन कॉपी ईमेल . के जिसे हम अलग-अलग लोगों को भेजना चाहते हैं।
  • फिर हम एक आउटलुक एप्लिकेशन ऑब्जेक्ट create बनाते हैं जिसे हम Email_Obj . द्वारा परिभाषित करते हैं . साथ ही, हम Single_Mail . का उपयोग करते हैं बनाने . के लिए एक आइटम Email_Obj . के लिए ।
  • उसके बाद, हम विषय . को परिभाषित करते हैं , ईमेल_प्रति , प्रतिलिपि , गुप्त प्रति , ईमेल_पाठ ईमेल . के आवश्यक भागों के रूप में बयान के साथ . द्वारा . हम .भेजें . भी डालते हैं इस कथन में आदेश दें।

  • अब, अपनी शीट पर वापस जाएं और मैक्रो . चलाएं नाम SendEmail01 जैसा कि यह आपके वर्तमान मैक्रो . का नाम है ।

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

  • इस ऑपरेशन को करने के बाद, आपको एक संदेश बॉक्स . दिखाई देगा पॉप अप आपको तारीख सीमा का चयन करने के लिए कहता है . श्रेणी . चुनें और ठीक . क्लिक करें ।

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

  • फिर, एक और संदेश बॉक्स पॉप अप होगा। विषय टाइप करें और ठीक . क्लिक करें ।

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

  • आपको संदेश बॉक्स . की एक श्रृंखला दिखाई देगी आपको ईमेल . भेजने के लिए आवश्यक जानकारी डालने के लिए कह रहा है . बस नीचे दी गई छवियों का अनुसरण करें।
  • अपना ईमेल पता डालें ।

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

  • ईमेल पता टाइप करें जहां आप अपना ईमेल . भेजेंगे ।

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

  • CC सम्मिलित करें प्राप्तकर्ता का पता

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

  • BCC लगाएं संदेश बॉक्स . में प्राप्तकर्ता अगर तुम चाहते हो। मैंने कोई नहीं चुना।

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

  • अपना संदेश लिखें।

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

  • अंतिम संदेश बॉक्स के बाद , आपको एक चेतावनी बॉक्स . दिखाई दे सकता है माइक्रोसॉफ्ट आउटलुक . से . अनुमति दें क्लिक करें ।

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

यह कार्रवाई ईमेल . भेजेगी आपके द्वारा संबंधित संदेश बॉक्स . में डाले गए पतों पर .
यह मुख्य ईमेल है ।

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

और नीचे कार्बन कॉपी . है ईमेल . के ।

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

Thus you can automatically send an Email from Excel based on the date . 

Read More:Excel Macro to Send Email Automatically (3 Suitable Examples)

2. Sending Email Automatically from Excel Based on Following Dates

In this section, we will send Emails based on the following or future dates . Suppose you want to send someone an Email prior to 3 days or 7 days. Let’s go through the following discussion on this matter.

चरण:

  • First, go to Section 1 to see how to open a VBA Module
  • Then type the following code in the VBA Module
Public Sub SendEmail02()
Dim Date_Range As Range
Dim Mail_Recipient As Range
Dim Email_Text As Range
Dim Outlook_App_Create As Object
Dim Mail_Item As Object
Dim Last_Row As Long
Dim VB_CR_LF, Email_Body, Date_Range_Value, Send_Value, Subject As String
Dim i As Long
On Error Resume Next
Set Date_Range = Application.InputBox("Please choose the date range:", "Message Box", , , , , , 8)
If Date_Range Is Nothing Then Exit Sub
Set Mail_Recipient = Application.InputBox("Please select the Email addresses:", "Message Box", , , , , , 8)
If Mail_Recipient Is Nothing Then Exit Sub
Set Email_Text = Application.InputBox("Select the Email Text:", "Message Box", , , , , , 8)
If Email_Text Is Nothing Then Exit Sub
Last_Row = Date_Range.Rows.Count
Set Date_Range = Date_Range(1)
Set Mail_Recipient = Mail_Recipient(1)
Set Email_Text = Email_Text(1)
Set Outlook_App_Create = CreateObject("Outlook.Application")
For i = 1 To Last_Row
Date_Range_Value = ""
Date_Range_Value = Date_Range.Offset(i - 1).Value
If Date_Range_Value <> "" Then
If CDate(Date_Range_Value) - Date <= 7 And CDate(Date_Range_Value) - Date > 0 Then
Send_Value = Mail_Recipient.Offset(i - 1).Value
Subject = Email_Text.Offset(i - 1).Value & " on " & Date_Range_Value
VB_CR_LF = "<br><br>"
Email_Body = "<HTML><BODY>"
Email_Body = Email_Body & "Dear " & Send_Value & VB_CR_LF
Email_Body = Email_Body & "Text : " & Email_Text.Offset(i - 1).Value & VB_CR_LF
Email_Body = Email_Body & "</BODY></HTML>"
Set Mail_Item = Outlook_App_Create.CreateItem(0)
With Mail_Item
.Subject = Subject
.To = Send_Value
.HTMLBody = Email_Body
.Display
End With
Set Mail_Item = Nothing
End If
End If
Next
Set Outlook_App_Create = Nothing
End Sub

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

Code Explanation

  • First, we declared some necessary variables:Date_Range , Mail_Recipient and Email_Text श्रेणी . के रूप में; Outlook_App_Create and Mail_Item as Object; Last_Row and i लंबे . के रूप में; VB_CR_LF (Visual Basic Carriage Return Line Feed ), Email_Body , Date_Range_Value , Send_Value , Subject as String
  • Then we set Date_Range to an InputBox where it can select a range तारीखों . में से via a Message Box . An If Statement is used to terminate Sub Procedure if the Date_Range is Nothing
  • We also set Mail_Recipient and Email_Text to InputBox
  • After that, we create an Outlook Application Object which we define by Outlook_App_Create
  • A date interval is introduced. In this code, the duration is 7 . Suppose you want someone to be reminded about an event or greetings 7 days after today which is 19th May . If the Emails you want to send are within the dates between 20th to 26th May , the recipient will receive the Email . Otherwise, it will not reach.
  • Then we put some commands to format the Email_Body . And also define the necessary parts of the Email by the With Statement
  • We used the .Display command here so that Outlook will open these Email drafts and we can check if any other messages need to be sent. You can use the .Send command if you don’t want to see the message drafts. But do not use these two commands simultaneously

  • Now, go back to your sheet and run the Macro named SendEmail02 as it is the name of your current Macro

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

  • After executing this operation, you will see a message box pop up telling you to select the date range . Select the range और ठीक . क्लिक करें ।

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

  • Then, another message box will pop up and it will tell you to select the Email address range . Select the range और ठीक . क्लिक करें ।

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

  • After that, select the range of text messages in the message box और ठीक . क्लिक करें ।

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

  • You will see the Email drafts for 21st May to 24th May . Here, the ID admin@wsxdn.com is an actual Email ID , so we sent the corresponding Email to this address to show you the example. You can put a CC recipient if you want.

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

  • Let’s check my Emails . This can be sent to Spam box too. So check everywhere.

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

Thus you can automatically send email based on following dates

और पढ़ें: Send Reminder Email Automatically from an Excel Worksheet Using VBA

समान रीडिंग

  • How to See Who Is in a Shared Excel File (With Quick Steps)
  • Enable Share Workbook in Excel
  • How to Share Excel File for Multiple Users
  • Send Bulk Email from Outlook Using Excel (3 Ways)
  • How to Apply Macro to Send Email from Excel with Attachment

3. Automatically Sending Email to a Single Address Based on a Date

We can also send an Email automatically single address based on a date . You can make a list of dates when you want to send the Emails to their corresponding recipients. Let’s go through the process below for a better understanding. In this section, we will only work with the dates

चरण:

  • First, go to Section 1 to see how to open a VBA Module
  • निम्न कोड को VBA मॉड्यूल में टाइप करें ।
Option Explicit
Sub SendEmail03()
Dim Date_Range As Range
Dim rng As Range
Set Date_Range = Range("B5:B10")
For Each rng In Date_Range
If rng.Value = Date Then
Dim Subject, Send_From, Send_To, _
Cc, Bcc, Body As String
Dim Email_Obj, Single_Mail As Variant
Subject = "Hello there!"
Send_From = "admin@wsxdn.com"
Send_To = "admin@wsxdn.com"
Cc = "admin@wsxdn.com"
Bcc = ""
Body = "Hope you are enjoying the article"
On Error GoTo debugs
Set Email_Obj = CreateObject("Outlook.Application")
Set Single_Mail = Email_Obj.CreateItem(0)
With Single_Mail
.Subject = Subject
.To = Send_To
.Cc = Cc
.Bcc = Bcc
.Body = Body
.send
End With
End If
Next
Exit Sub
debugs:
If Err.Description <> "" Then MsgBox Err.Description
End Sub

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

Code Explanation

  • First, we declared some necessary variables:rng and Date_Range श्रेणी . के रूप में ।
  • Then we define the range for Date_Range
  • After that, we use Value in a VBA IF Statement and also set Subject , Send_From , Send_To , Cc , Bcc and Body to String . Also, we set Email_Obj and Single_Mail as Variant
  • Then we set the text value for Subject , Send_From , Send_To , Cc and Bcc
  • Later, we create an Outlook Application Object which we define by Email_Obj . Also, we use Single_Mail to create an item for Email_Obj
  • After that, we define Subject , Send_To , Cc , Bcc , Body as the necessary parts of an Email by a With Statement . We also put the .Send command in this statement.

  • Now, go back to your sheet and run the Macro named SendEmail01 as it is the name of your current Macro

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

  • After that, you may see a warning box from Microsoft Outlook . अनुमति दें क्लिक करें ।

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

This operation will send the Email to the addresses that you put in the corresponding message boxes

This is the main Email

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

And below here is the Carbon Copy of the Email

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

Thus you can automatically send an Email from Excel based on the date . 

और पढ़ें: How to Send Email Automatically When Condition Met in Excel

अभ्यास अनुभाग

In this section, I’m giving you the dataset that we used in this article so that you can practice on your own.

तारीख के आधार पर एक्सेल से स्वचालित रूप से ईमेल कैसे भेजें

याद रखने वाली बातें

Always open and log into your Outlook  account to run the VBA  codes in this article.

निष्कर्ष

The bottom line is, that you will learn effective methods on how to automatically send Email from Excel based on date . If you have any better ideas or feedback, please share them in the comment box. This will help me enrich my upcoming articles.

संबंधित लेख

  • [समाधान]:शेयर वर्कबुक एक्सेल में नहीं दिख रहा है (आसान चरणों के साथ)
  • एक्सेल सूची से ईमेल कैसे भेजें (2 प्रभावी तरीके)
  • ईमेल द्वारा संपादन योग्य एक्सेल स्प्रेडशीट कैसे भेजें (3 त्वरित तरीके)
  • एक्सेल से ईमेल भेजने के लिए मैक्रो (5 उपयुक्त उदाहरण)
  • मैक्रो एक्सेल से बॉडी के साथ ईमेल भेजने के लिए (3 उपयोगी मामले)
  • एक्सेल मैक्रो:सेल में किसी पते पर ईमेल भेजें (2 आसान तरीके)

  1. ईमेल द्वारा संपादन योग्य एक्सेल स्प्रेडशीट कैसे भेजें (3 त्वरित तरीके)

    हम आसानी से एक्सेल फाइलों को ईमेल से अटैचमेंट के रूप में भेज सकते हैं . लेकिन यह कुछ विशेष मामलों के लिए हमेशा संभव नहीं होता है, जैसे आप अपनी एक्सेल फ़ाइल से केवल एक स्प्रेडशीट भेजना चाहते हैं। एक्सेल से, हम इसे आसानी से और जल्दी से कर सकते हैं। तो इस लेख में, आप सीखेंगे 3 त्वरित ईमेल द्वारा संपादन

  1. सेल सामग्री के आधार पर एक्सेल से स्वचालित रूप से ईमेल भेजें (2 तरीके)

    हम अपने Excel . में विभिन्न प्रकार की जानकारी संग्रहीत करते हैं कार्यपत्रक उदाहरण के लिए, इसमें ईमेल . हो सकता है महत्वपूर्ण लोगों या अन्य कंपनियों के पते। माइक्रोसॉफ्ट के साथ काम करते समय एक्सेल, कभी-कभी हमें ईमेल भेजने की आवश्यकता होती है। आमतौर पर, ईमेल . भेजना आसान होता है आउटलुक . से या जीम

  1. एक्सेल से आउटलुक में अटैचमेंट के साथ मेल मर्ज कैसे करें (2 उदाहरण)

    मेल मर्ज का उपयोग करना , हम दस्तावेज़ों का एक संग्रह बना सकते हैं जो प्रत्येक प्राप्तकर्ता को व्यक्तिगत रूप से प्राप्त होता है। यदि आप एक्सेल से आउटलुक में मेल मर्ज करने के लिए कुछ विशेष तरकीबें खोज रहे हैं अनुलग्नकों के साथ, आप सही जगह पर आए हैं। अनुलग्नकों के साथ एक्सेल से आउटलुक में मेल मर्ज करन