Skip to main content

Conas seoladh ríomhphoist an tseoltóra a fháil ó ríomhphost amháin nó níos mó in Outlook?

An ndearna tú iarracht riamh an seoladh ríomhphoist a bhaint as an réimse "Ó" de ríomhphost amháin nó níos mó a fuarthas in Outlook? Soláthraíonn an t-alt seo cód VBA chun cabhrú leat an tasc seo a láimhseáil.


Faigh seoladh ríomhphoist an tseoltóra ó ríomhphost amháin nó níos mó in Outlook

Rith an cód VBA seo a leanas le do thoil chun an seoladh ríomhphoist a bhaint as an réimse “Ó” de ríomhphost amháin nó níos mó a fuarthas in Outlook.

1. Oscail fillteán ríomhphoist, roghnaigh teachtaireacht ríomhphoist óna dteastaíonn uait seoladh ríomhphoist an tseoltóra a fháil. Brúigh an Eile + F11 eochracha a oscailt Microsoft Visual Basic d’Fheidhmchláir fhuinneog.

Leideanna: Chun ríomhphoist iolracha a roghnú, coinnigh síos an Ctrl eochair agus ansin roghnaigh na ríomhphoist ceann ar cheann.

2. Sa Microsoft Visual Basic d’Fheidhmchláir fuinneog, cliceáil Ionsáigh > Modúil, ansin cóipeáil an cód VBA seo a leanas chuig an fhuinneog Modúl (cód).

Cód VBA: bain seoladh ríomhphoist an tseoltóra ó ríomhphost amháin nó níos mó in Outlook

Sub GetSmtpAddressOfSelectionEmail()
  Dim xExplorer As Explorer
  Dim xSelection As Selection
  Dim xItem As Object
  Dim xMail As MailItem
  Dim xAddress As String
  Dim xFldObj As Object
  Dim FilePath As String
  Dim xFSO As Scripting.FileSystemObject
  On Error Resume Next
  Set xExplorer = Application.ActiveExplorer
  Set xSelection = xExplorer.Selection
  For Each xItem In xSelection
    If xItem.Class = olMail Then
      Set xMail = xItem
      xAddress = xAddress & VBA.vbCrLf & "  " & GetSmtpAddress(xMail)
    End If
  Next
  If MsgBox("Sender SMTP Address is: " & xAddress & vbCrLf & vbCrLf & "Do you want to export the address list to a txt file? ", vbYesNo, "Kutools for Outlook") = vbYes Then
    Set xFldObj = CreateObject("Shell.Application").BrowseforFolder(0, "Select a Folder", 0, 16)
    Set xFSO = New Scripting.FileSystemObject
    If xFldObj Is Nothing Then Exit Sub
    FilePath = xFldObj.Items.Item.Path & "\Address.txt"
    Close #1
    Open FilePath For Output As #1
    Print #1, "Sender SMTP Address is: " & xAddress
    Close #1
    Set xFSO = Nothing
    Set xFldObj = Nothing
    MsgBox "Address list has been exported to:" & FilePath, vbOKOnly + vbInformation, "Kutools for Outlook"
  End If
End Sub
Function GetSmtpAddress(Mail As MailItem)
  Dim xNameSpace As Outlook.NameSpace
  Dim xEntryID As String
  Dim xAddressEntry As AddressEntry
  Dim PR_SENT_REPRESENTING_ENTRYID As String
  Dim PR_SMTP_ADDRESS As String
  Dim xExchangeUser As exchangeUser
  On Error Resume Next
  GetSmtpAddress = ""
  Set xNameSpace = Application.Session
  If Mail.sender.Type <> "EX" Then
    GetSmtpAddress = Mail.sender.Address
  Else
    PR_SENT_REPRESENTING_ENTRYID = "http://schemas.microsoft.com/mapi/proptag/0x00410102"
    xEntryID = Mail.PropertyAccessor.BinaryToString(Mail.PropertyAccessor.GetProperty(PR_SENT_REPRESENTING_ENTRYID))
    Set xAddressEntry = xNameSpace.GetAddressEntryFromID(xEntryID)
    If xAddressEntry Is Nothing Then Exit Function
    If xAddressEntry.AddressEntryUserType = olExchangeUserAddressEntry Or xAddressEntry.AddressEntryUserType = olExchangeRemoteUserAddressEntry Then
      Set xExchangeUser = xAddressEntry.GetExchangeUser()
      If xExchangeUser Is Nothing Then Exit Function
      GetSmtpAddress = xExchangeUser.PrimarySmtpAddress
    Else
      PR_SMTP_ADDRESS = "http://schemas.microsoft.com/mapi/proptag/0x39FE001E"
      GetSmtpAddress = xAddressEntry.PropertyAccessor.GetProperty(PR_SMTP_ADDRESS)
    End If
  End If
End Function

3. cliceáil uirlisí > tagairtí, ansin seiceáil an Microsoft Scripting Runtime bosca sa Tagairtí – Tionscadal1 dialóg.

4. Brúigh an F5 eochair chun an cód a rith. Ansin a Kutools le haghaidh Outlook tagann an bosca dialóige suas, ag liostú seoltaí ríomhphoist uile an tseoltóra ar na ríomhphoist roghnaithe.

Leideanna:

Más gá duit an liosta seoltaí a onnmhairiú go comhad txt, cliceáil ar an Is ea cnaipe.
Nó cliceáil ar an Uimh cnaipe chun deireadh a chur leis an bpróiseas.

5. Tar éis cliceáil ar an Is ea cnaipe, a Brabhsáil Chun Fillteán tagann an bosca dialóige suas. Roghnaigh fillteán chun an comhad a shábháil agus cliceáil ar an OK cnaipe.

6. Faoi dheireadh, a Kutools le haghaidh Outlook Beidh an bosca dialóige pop suas, ag insint duit an cosán an chomhaid easpórtáilte. Cliceáil OK a dhúnadh.

7. Téigh go dtí an fillteán ina bhfuil an comhad a onnmhairiú a shábháil agus a oscailt an comhad .txt ainmnithe Seoladh chun seoltaí ríomhphoist an tseoltóra ar na ríomhphoist roghnaithe a fheiceáil.


Uirlisí Táirgiúlachta Oifige is Fearr

Kutools le haghaidh Outlook - Níos mó ná 100 Gnéithe cumhachtacha chun do Outlook a shárú

🤖 Cúntóir Ríomhphoist AI: Ríomhphoist pro toirt le draíocht AI - aon-cliceáil chun freagraí genius, ton foirfe, máistreacht ilteangach. Trasfhoirmigh ríomhphost gan stró! ...

📧 Uathoibriú Ríomhphoist: As Oifig (Ar fáil do POP agus IMAP)  /  Sceideal Seol Ríomhphoist  /  Auto CC/BCC de réir Rialacha Agus Ríomhphost á Sheoladh  /  Auto Ar Aghaidh (Ardrialacha)   /  Beannacht Auto Cuir leis   /  Scoilt Ríomhphoist Ilfhaighteoirí go huathoibríoch i dTeachtaireachtaí Aonair ...

📨 Bainistíocht Ríomhphost: Ríomhphoist a Athghairm go héasca  /  Bloc Ríomhphoist Scam ag Ábhair agus Daoine Eile  /  Scrios Ríomhphoist Dúblacha  /  Cuardach Casta  /  Comhdhlúthaigh Fillteáin ...

📁 Ceangaltáin ProSábháil Baisc  /  Baisc Dícheangail  /  Comhbhrú Baisc  /  Auto Sábháil   /  Auto Dícheangail  /  Comhbhrúite Auto ...

🌟 Draíocht Chomhéadain: 😊Níos mó Emojis Pretty and Cool   /  Treisiú Do Tháirgiúlacht Outlook le Radhairc Tabbed  /  Íoslaghdaigh Outlook In ionad Deiridh ...

???? Wonders aon-cliceáil: Freagair Gach Duine le Ceangaltáin Isteach  /   Ríomhphoist Frith-Iascaireachta  /  🕘 Taispeáin Crios Ama an tSeoltóra ...

👩🏼‍🤝‍👩🏻 Teagmhálaithe & Féilire: Baisc Cuir Teagmhálacha Ó Ríomhphoist Roghnaithe  /  Roinn Grúpa Teagmhála ar Ghrúpaí Aonair  /  Bain Meabhrúcháin Breithlá ...

Thar Gnéithe 100 Fan le do Thaiscéalaíocht! Cliceáil Anseo le Tuilleadh Amach.

 

 

Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations