Skip i'r prif gynnwys

Sut i anfon e-bost yn gyflym yn seiliedig ar ddyddiad yng nghell Excel?

Ydych chi erioed wedi ceisio anfon E-bost yn seiliedig ar ddyddiad yng nghell Excel? Er enghraifft, dyma restr o ddyddiadau yng ngholofn A, ac yna rydych chi am anfon E-bost gyda'r pwnc, corff negeseuon at dderbynnydd (hefyd a all CC a BCC at eraill), sut allwch chi ei drin?

Anfon E-bost yn seiliedig ar ddyddiad gyda VBA


Anfon E-bost yn seiliedig ar ddyddiad gyda VBA

I anfon e-bost yn seiliedig ar y dyddiad yn Excel, dim ond cod macro y gallwch ei gymhwyso.

1. Galluogi'r ddalen sy'n cynnwys data a'r dyddiad rydych chi'n ei ddefnyddio, a gwasgwch Alt + F11 allweddi i alluogi'r Microsoft Visual Basic ar gyfer Ceisiadau ffenestr.

2. Cliciwch Mewnosod > Modiwlau, a'i gludo o dan y cod i'r sgript wag. 

VBA: Anfon yn ôl dyddiad

Sub email()
'UpdatebyExtendoffice20170831
    Dim xRg As Range
    Dim xRgEach As Range
    Dim xAddress As String
    Dim xEmail_Subject, xEmail_Send_From, xEmail_Send_To, xEmail_Cc, xEmail_Bcc, xEmail_Body As String
    Dim xMail_Object, xMail_Single As Object
    On Error Resume Next
    xAddress = ActiveWindow.RangeSelection.Address
    Set xRg = Application.InputBox("Select a range:", "KuTools For Excel", xAddress, , , , , 8)
    If xRg Is Nothing Then Exit Sub
    For Each xRgEach In xRg
        If xRgEach.Value = Date Then
            xEmail_Subject = Application.InputBox("Subject: ", "Kutools", , , , , , 2)
            xEmail_Send_From = Application.InputBox("Send from: ", "KuTools For Excel", , , , , , 2)
            xEmail_Send_To = Application.InputBox("Send to: ", "KuTools For Excel", , , , , , 2)
            If xEmail_Send_To = "" Then Exit Sub
            xEmail_Cc = Application.InputBox("CC: ", "KuTools For Excel", , , , , , 2)
            xEmail_Bcc = Application.InputBox("BCC: ", "KuTools For Excel", , , , , , 2)
            xEmail_Body = Application.InputBox("Message Body: ", "KuTools For Excel", , , , , , 2)
            Set xMail_Object = CreateObject("Outlook.Application")
            Set xMail_Single = xMail_Object.CreateItem(0)
            With xMail_Single
                .Subject = xEmail_Subject
                .To = xEmail_Send_To
                .cc = xEmail_Cc
                .BCC = xEmail_Bcc
                .Body = xEmail_Body
                .Send
            End With
        End If
    Next
End Sub

3. Cliciwch Run botwm neu wasg F5 yn allweddol i weithredu'r cod, mae deialog yn ymddangos i'ch atgoffa i ddewis rhestr o ddyddiad. Gweler y screenshot:
anfon doc erbyn dyddiad 1

4. Cliciwch ar OK, a pharhewch i nodi'r pwnc e-bost, cyfeiriad e-bost yr anfonwr, cyfeiriad e-bost y derbynnydd, y CC, BCC, a'r corff negeseuon. Gweler y screenshot:

anfon doc erbyn dyddiad 2 saeth saethu i'r dde anfon doc erbyn dyddiad 3 saeth saethu i'r dde anfon doc erbyn dyddiad 4
        saeth doc i lawr
anfon doc erbyn dyddiad 7 saeth saethu i'r chwith anfon doc erbyn dyddiad 6 saeth saethu i'r chwith anfon doc erbyn dyddiad 5

5. Cliciwch OK > OK tan yr un olaf, ac yna mae'r e-bost wedi'i anfon.
anfon doc erbyn dyddiad 8

Nodyn: rhaid i gyfeiriad e-bost yr anfonwr fod y cyfrif diofyn yn eich Camre.


Creu Rhestr Bostio ac Anfon E-byst

doc anfon e-bost

Offer Cynhyrchiant Swyddfa Gorau

🤖 Kutools AI Aide: Chwyldro dadansoddi data yn seiliedig ar: Cyflawniad Deallus   |  Cynhyrchu Cod  |  Creu Fformiwlâu Personol  |  Dadansoddi Data a Chynhyrchu Siartiau  |  Invoke Swyddogaethau Kutools...
Nodweddion Poblogaidd: Darganfod, Amlygu neu Adnabod Dyblygiadau   |  Dileu Rhesi Gwag   |  Cyfuno Colofnau neu Gelloedd heb Colli Data   |   Rownd heb Fformiwla ...
Super-edrych: VLookup Meini Prawf Lluosog    VLookup Gwerth Lluosog  |   VLookup Ar Draws Taflenni Lluosog   |   Edrych Niwlog ....
Rhestr gwympo Uwch: Creu Rhestr Gollwng yn Gyflym   |  Rhestr Gollwng Dibynnol   |  Rhestr Gollwng Aml-ddewis ....
Rheolwr Colofn: Ychwanegu Nifer Penodol o Golofnau  |  Symud Colofnau  |  Toglo Statws Gwelededd Colofnau Cudd  |  Cymharwch Ystodau a Cholofnau ...
Nodweddion dan Sylw: Ffocws ar y Grid   |  Golwg Dylunio   |   Bar Fformiwla Mawr    Rheolwr Llyfr Gwaith a Thaflen   |  Llyfrgell Adnoddau (Testun Auto)   |  Dewiswr Dyddiad   |  Cyfuno Taflenni Gwaith   |  Amgryptio/Dadgryptio Celloedd    Anfon E-byst trwy Restr   |  Hidlo Super   |   Hidlo Arbennig (hidlo mewn print trwm/italig/strikethrough...) ...
15 Set Offer Gorau12 Testun offer (Ychwanegu Testun, Dileu Cymeriadau,...)   |   50 + Siart Mathau (Siart Gantt,...)   |   40+ Ymarferol Fformiwlâu (Cyfrifwch oedran yn seiliedig ar ben-blwydd,...)   |   19 mewnosod offer (Mewnosod Cod QR, Mewnosod Llun o'r Llwybr,...)   |   12 Trosi offer (Rhifau i Eiriau, Trosi arian cyfred,...)   |   7 Uno a Hollti offer (Rhesi Cyfuno Uwch, Celloedd Hollt,...)   |   ... a mwy

Supercharge Eich Sgiliau Excel gyda Kutools ar gyfer Excel, a Phrofiad Effeithlonrwydd Fel Erioed Erioed. Kutools ar gyfer Excel Yn Cynnig Dros 300 o Nodweddion Uwch i Hybu Cynhyrchiant ac Arbed Amser.  Cliciwch Yma i Gael Y Nodwedd Sydd Ei Angen Y Mwyaf...

Disgrifiad


Mae Office Tab yn dod â rhyngwyneb Tabbed i Office, ac yn Gwneud Eich Gwaith yn Haws o lawer

  • Galluogi golygu a darllen tabbed yn Word, Excel, PowerPoint, Cyhoeddwr, Mynediad, Visio a Phrosiect.
  • Agor a chreu dogfennau lluosog mewn tabiau newydd o'r un ffenestr, yn hytrach nag mewn ffenestri newydd.
  • Yn cynyddu eich cynhyrchiant 50%, ac yn lleihau cannoedd o gliciau llygoden i chi bob dydd!
Comments (16)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
When I click run the date an I am asked to select a range nothing happens after I click ok?
This comment was minimized by the moderator on the site
Hi, jason, you need to select a cell or range that contains date(s), if the selected cell or range is empty or not contains date(s), the macro will exit.
This comment was minimized by the moderator on the site
Hi,


That is perfect, but when I add or change a date, it wont send the email Automatiklicht, I have to run the code again and by that I have to choose date range, sender, receiver and all info again. is there anyway to solve this issue?
This comment was minimized by the moderator on the site
its not going on next xRgEach if i am having same dates multiple times, its sending mails to same user multiple times.
This comment was minimized by the moderator on the site
Hi, vaibhav, you can remove the duplicate times by using Remove Duplicates feature in Data Tools under Data tab, then using the VBA.
This comment was minimized by the moderator on the site
Çok teşekkür ederim..
This comment was minimized by the moderator on the site
Merhaba, bir excel dosyasında hatırlatıcı olarak bu konuyla ilgili VSB nin nasıl yapıldığı ile ilgili bilgiye ihtiyacım var. Örneğin boş bir hücreye bilgi girildiğinde bana mail at ya da 3 hafta sıklıkla hücreye bilgi girilip girilmediğiyle alakalı bana bilgi ver.

Hertürlü bilgi ve kaynağa açığım. Şimdiden herkese teşekkür ederim..
This comment was minimized by the moderator on the site
Hi, Mehmet, here is a tutorial How To Send Email If A Certain Cell Is Modified In Excel? that talking about sending an email with the excel file as attachment if the cells in the specific range are modified, which may help you.
This comment was minimized by the moderator on the site
Bonjour j'ai copié les codes, à la validation il me demande bien les cellules concernées, mais lorsque que je valide, il ne me propose pas la suite des fenêtres, sujets, adresses etc
This comment was minimized by the moderator on the site
Hi, boutry, sorry I that reply with English since I do not know French. May I know your date time format? I guess maybe the code only work for datetime in English date format.
This comment was minimized by the moderator on the site
The boxes do not automatically populate after I hit OK. Where do I change the subject, email address and body of the email in the code?
This comment was minimized by the moderator on the site
holagracias por tu ayuda...tengo una consulta.....en la formula Set xRgDate = Application.InputBox("Please select the due date column:", "KuTools For Excel", , , , , , 8), el 8 que significa?
This comment was minimized by the moderator on the site
Felicidades por el material; pero no me funciona. Al parecer el Rango no se llena, por ende queda vacío y sale de la rutina.

Alguna corrección ?
This comment was minimized by the moderator on the site
This is close to what I need but I am stuck with two problems. 1st I need to run this across my entire workbook that gets new worksheets added daily. 2nd I need it to include the worksheet name in the email so I will know which sheet is due. I create new tickets (worksheets) with a field that is a future date, when that day arrives I need an email. Thank you for your help.
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations