Skip i'r prif gynnwys

Sut i gael rhybudd wrth anfon e-bost i barth allanol yn Outlook?

Wrth ddefnyddio Outlook, sut allwch chi atal anfon e-byst yn ddamweiniol at dderbynwyr y tu allan i'ch cwmni? Mewn gwirionedd, gallwch arddangos blwch rhybuddio wrth anfon e-bost i barth allanol yn Outlook. Bydd yr erthygl hon yn cyflwyno dull VBA i'w gyflawni.

Sicrhewch rybudd wrth anfon e-bost i barth allanol gyda chod VBA


Sicrhewch rybudd wrth anfon e-bost i barth allanol gyda chod VBA

Gall y cod VBA canlynol eich helpu i gael rhybudd wrth anfon e-bost i barth allanol yn Outlook. Gwnewch fel a ganlyn.

1. Gwasgwch y Alt + F11 allweddi i agor y Microsoft Visual Basic ar gyfer Ceisiadau ffenestr.

2. Yn y Microsoft Visual Basic ar gyfer Ceisiadau ffenestr, cliciwch ddwywaith SesiwnOutlook i agor y ThisOutlookSession (Cod) ffenestr, ac yna copïwch isod god VBA i'r ffenestr. Gweler y screenshot:

Cod VBA: Sicrhewch rybudd wrth anfon e-bost i barth allanol

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
'Update by Extendoffice 20180504
Dim xMailItem As Outlook.MailItem
Dim xRecipients As Outlook.Recipients
Dim i As Long
Dim xRecipientAddress As String
Dim xPrompt As String
Dim xYesNo As Integer
Dim xPos As Integer
On Error Resume Next
If Item.Class <> olMail Then Exit Sub
Set xMailItem = Item
Set xRecipients = xMailItem.Recipients
For i = xRecipients.Count To 1 Step -1
    xRecipientAddress = xRecipients.Item(i).Address
    xPos = InStrRev(LCase(xRecipientAddress), "@addin99.com")
    If xPos <= 0 Then Exit For
    Cancel = False
Next
If InStrRev(LCase(xRecipientAddress), "@addin99.com") > 0 Then Exit Sub
xPrompt = "Are you sure to send this email to outside your company? "
xYesNo = MsgBox(xPrompt, vbYesNo + vbQuestion, "Kutools for Outlook")
If xYesNo = vbNo Then Cancel = True
End Sub

Nodyn: Yn y cod, “@ addin99.com”Yw'r parth e-bost mewnol y byddwch chi'n anfon e-byst ato. Newidiwch ef yn ôl yr angen.

O hyn ymlaen, wrth glicio Anfon botwm i anfon e-byst i barth e-bost allanol (nid y parth e-bost mewnol a nodwyd gennych yn y cod VBA), bydd blwch rhybuddio yn ymddangos fel islaw'r screenshot a ddangosir.


Erthyglau cysylltiedig:

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 (7)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Doesn't work, no pop-up is showing.
This comment was minimized by the moderator on the site
It works just fine, but there a few things you have to change to get it to work every time you load outlook. Macro security settings need to be changed.
This comment was minimized by the moderator on the site
I had the same problem - getting warning also for the internal e-mails.
When the internal e-mail address from Directory is used, xRecipientAddress does not return the address, but some weird exchange string like /O=<organization...> - try to print it in MsgBox and you will see yours.
This comment was minimized by the moderator on the site
Did you overcome this?
This comment was minimized by the moderator on the site
This does not work. I do not get a pop up for internal or external.
This comment was minimized by the moderator on the site
This is prompting both internal and external emails. both domain fields have been updated. Any thoughts? Many thanks
This comment was minimized by the moderator on the site
Hola:



Gran aporte pero me lo pregunta para todos los envíos y no solo para los de una determinada dirección. Es decir, siempre me sale el mensaje independientemente del dominio... ¿está bien el código? Gracias.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations