Skip to main content

Conas ríomhphost a sheoladh go tapa bunaithe ar dháta i gcill Excel?

An ndearna tú iarracht riamh Ríomhphost a sheoladh bunaithe ar dháta i gcill Excel? Mar shampla, seo liosta de na dátaí i gcolún A, agus ansin ba mhaith leat R-phost leis an ábhar, an comhlacht teachtaireachta a sheoladh chuig faighteoir (an féidir le CC agus BCC a chur chuig daoine eile freisin), conas is féidir leat é a láimhseáil?

Seol Ríomhphost bunaithe ar dháta le VBA


Seol Ríomhphost bunaithe ar dháta le VBA

Chun ríomhphost a sheoladh bunaithe ar an dáta in Excel, ní féidir leat ach macra-chód a chur i bhfeidhm.

1. Cumasaigh an bhileog ina bhfuil sonraí agus an dáta a úsáideann tú, agus brúigh Alt + F11 eochracha chun an Microsoft Visual Basic d’Fheidhmchláir fhuinneog.

2. cliceáil Ionsáigh > Modúil, agus greamaigh thíos an cód leis an script bán. 

VBA: Seol de réir dáta

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. cliceáil Rith cnaipe nó brúigh F5 eochair chun an cód a fhorghníomhú, tagann dialóg amach le cur i gcuimhne duit liosta dáta a roghnú. Féach an pictiúr:
seol doc faoi dháta 1

4. Cliceáil OK, agus lean ort ag sonrú an ábhair ríomhphoist, seoladh ríomhphoist an tseoltóra, seoladh ríomhphoist an ghlacadóra, an CC, BCC, agus an comhlacht teachtaireachta. Féach an pictiúr:

seol doc faoi dháta 2 saighead lámhaigh ar dheis seol doc faoi dháta 3 saighead lámhaigh ar dheis seol doc faoi dháta 4
        saighead doc síos
seol doc faoi dháta 7 saighead lámhaigh ar chlé seol doc faoi dháta 6 saighead lámhaigh ar chlé seol doc faoi dháta 5

5. cliceáil OK > OK go dtí an ceann deireanach, agus ansin tá an ríomhphost seolta.
seol doc faoi dháta 8

Nóta: caithfidh gurb é seoladh ríomhphoist an seoltóra an cuntas réamhshocraithe i do Outlook.


Cruthaigh Liosta Ríomhphoist agus Seol Ríomhphoist

doc seol r-phost

Uirlisí Táirgiúlachta Oifige is Fearr

🤖 Kutools AI Aide: anailís sonraí a réabhlóidiú bunaithe ar: Forghníomhú Chliste   |  Gin Cód  |  Cruthaigh Foirmlí Saincheaptha  |  Anailís a dhéanamh ar Sonraí agus Cairteacha a Ghin  |  Feidhmeanna Kutools a agairt...
Gnéithe Coitianta: Faigh, Aibhsigh nó Aithnigh Dúblaigh   |  Scrios Sraitheanna Bána   |  Comhcheangail Colúin nó Cealla gan Sonraí a Chailleadh   |   Babhta gan Foirmle ...
Cuardaigh Super: Ilchritéir VLookup    VLookup Illuachanna  |   VLookup Trasna Ilbhileoga   |   Amharc doiléir ....
Liosta anuas Casta: Go tapa Cruthaigh Liosta Anuas   |  Liosta anuas Cleithiúnach   |  Liosta Buail Isteach Ilroghnacha ....
Bainisteoir Colún: Cuir Líon Sonrach Colún leis  |  Colúin Bog  |  Scoránaigh Stádas Infheictheachta na gColún Ceilte  |  Déan comparáid idir Raonta & Colúin ...
Gnéithe Réadmhaoin: Fócas Eangaí   |  Amharc Dearaidh   |   Barra Mór na Foirmle    Leabhar Oibre & Bainisteoir Bileog   |  Leabharlann Acmhainní (Uaththéacs)   |  Piocálaí Dáta   |  Comhcheangail Bileoga Oibre   |  Criptigh/Díchriptigh Cealla    Seol Ríomhphost trí Liosta   |  Scagaire Super   |   Scagaire Speisialta (scagaire trom/iodálach/stailc tríd...) ...
Barr 15 Uirlisí12 Téacs uirlisí (Cuir Téacs, Bain Carachtair,...)   |   50 + Cairt cineálacha (Cairt Gantt,...)   |   40+ Praiticiúil Foirmlí (Ríomh aois bunaithe ar lá breithe,...)   |   19 Insertion uirlisí (Cuir isteach Cód QR, Ionsáigh Pictiúr ón gCosán,...)   |   12 Tiontú uirlisí (Uimhreacha le Focail, Comhshó Airgeadra,...)   |   7 Cumaisc & Scoilt uirlisí (Sraitheanna Comhcheangail Casta, Cealla Scoilt,...)   |   ... agus eile

Supercharge Do Scileanna Excel le Kutools le haghaidh Excel, agus Éifeachtúlacht Taithí Cosúil Ná Roimhe. Kutools le haghaidh Excel Tairiscintí Níos mó ná 300 Ardghnéithe chun Táirgiúlacht a Treisiú agus Sábháil Am.  Cliceáil anseo chun an ghné is mó a theastaíonn uait a fháil ...

Tuairisc


Tugann Tab Oifige comhéadan Tabbed chuig Office, agus Déan Do Obair i bhfad Níos Éasca

  • Cumasaigh eagarthóireacht agus léamh tabbed i Word, Excel, PowerPoint, Foilsitheoir, Rochtain, Visio agus Tionscadal.
  • Oscail agus cruthaigh cáipéisí iolracha i gcluaisíní nua den fhuinneog chéanna, seachas i bhfuinneoga nua.
  • Méadaíonn do tháirgiúlacht 50%, agus laghdaíonn sé na céadta cad a tharlaíonn nuair luch duit gach lá!
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