Vidakuzi vinatusaidia kutoa huduma zetu. Kwa kutumia huduma zetu, unakubaliana na matumizi yetu ya kuki.
Kidokezo: Lugha zingine ni Google-Ilitafsiriwa. Unaweza kutembelea English toleo la kiungo hiki.
Ingia
x
or
x
x
Daftari
x

or

Jinsi ya kuuza nje barua pepe kutoka kwa Outlook hadi Excel moja kwa moja?

Kwa kawaida, unaweza kuuza nje barua pepe kutoka kwa Outlook hadi Excel na kipengele cha Import / Export. Lakini, umewahi kujaribu kujituma barua pepe kwenye faili ya Excel wakati ujumbe mpya unapofika? Katika makala hii, nitazungumzia kuhusu jinsi ya kuuza nje habari ya ujumbe mpya unaoingia katika Excel.

Jumuisha nje ya barua pepe habari kutoka kwa mtazamo wa Excel na msimbo wa VBA


Fanya haraka mizani kutoka kwa Kikasha / Vipengee vya Bidhaa / Programu ... kwa faili ya Excel:

pamoja Kutools kwa Outlook's Ripoti ya Haraka kipengele, unaweza kuzalisha faili ya XML kwa urahisi kwa taarifa ya vitu vyote katika folda ya sasa ya barua pepe au folda ya kazi

doc barua pepe za nje ya nje ili kuzidi 5

Kutools kwa Outlook: na zaidi ya 40 + Handy inser inser, bure kujaribu na hakuna kupunguzwa katika siku 60. Pakua na jaribu jaribio la bure sasa!

Jumuisha nje ya barua pepe habari kutoka kwa mtazamo wa Excel na msimbo wa VBA

Ili kuuza nje barua pepe mpya za kuwasili kwenye kitabu cha Excel moja kwa moja, tafadhali tumia kanuni ya VBA ifuatayo:

1. Kwanza, unapaswa kuunda kitabu cha habari na habari chini ya kichwa kama skrini ifuatayo inavyoonyeshwa, hivyo maelezo haya ya ujumbe yatapelekwa kwenye faili hii ya Excel.

doc barua pepe za nje ya nje ili kuzidi 1

2. Kisha kwenda kwa Outlook na ushikilie ALT + F11 funguo za kufungua Microsoft Visual Msingi kwa Maombi dirisha.

3. Ndani ya Microsoft Visual Msingi kwa Maombi dirisha, bonyeza mara mbili HiiOutlookSession kutoka Project1 (VbaProject.OTM) pane ili kufungua mode, na kisha nakala na kushika nambari ifuatayo kwenye moduli tupu.

VBA code: Auto nje ya barua pepe habari kutoka Outlook kwa Excel faili:

Public WithEvents GMailItems As Outlook.Items
Private Sub Application_Startup()
    Set GMailItems = Outlook.Application.Session.GetDefaultFolder(olFolderInbox).Items
End Sub
Private Sub GMailItems_ItemAdd(ByVal Item As Object)
    Dim xMailItem As Outlook.MailItem
    Dim xExcelFile As String
    Dim xExcelApp As Excel.Application
    Dim xWb As Excel.Workbook
    Dim xWs As Excel.Worksheet
    Dim xNextEmptyRow As Integer
    On Error Resume Next
    If Item.Class <> olMail Then Exit Sub
    Set xMailItem = Item
    xExcelFile = "C:\Users\DT168\Desktop\split document\kto-data.xlsx"
    If IsWorkBookOpen(xExcelFile) = True Then
        Set xExcelApp = GetObject(, "Excel.Application")
        Set xWb = GetObject(xExcelFile)
        If Not xWb Is Nothing Then xWb.Close True
    Else
        Set xExcelApp = New Excel.Application
    End If
    Set xWb = xExcelApp.Workbooks.Open(xExcelFile)
    Set xWs = xWb.Sheets(1)
    xNextEmptyRow = xWs.Range("B" & xWs.Rows.Count).End(xlUp).Row + 1
    With xWs
        .Cells(xNextEmptyRow, 1) = xNextEmptyRow - 1
        .Cells(xNextEmptyRow, 2) = xMailItem.SenderName
        .Cells(xNextEmptyRow, 3) = xMailItem.SenderEmailAddress
        .Cells(xNextEmptyRow, 4) = xMailItem.Subject
        .Cells(xNextEmptyRow, 5) = xMailItem.ReceivedTime
    End With
    xWs.Columns("A:E").AutoFit
    xWb.Save
End Sub
Function IsWorkBookOpen(FileName As String)
    Dim xFreeFile As Long, xErrNo As Long
    On Error Resume Next
    xFreeFile = FreeFile()
    Open FileName For Input Lock Read As #xFreeFile
    Close xFreeFile
    xErrNo = Err
    On Error GoTo 0
    Select Case xErrNo
        Case 0: IsWorkBookOpen = False
        Case 70: IsWorkBookOpen = True
        Case Else: Error xErrNo
    End Select
End Function

Kumbuka: Katika kanuni iliyo hapo juu, C: \ Watumiaji \ DT168 \ Desktop \ kupasua waraka \ kto-data.xlsx ni njia ya faili ya Excel na Jina la Excel ambalo unataka kupata maelezo ya nje, tafadhali tengeneze kwa mahitaji yako.

doc barua pepe za nje ya nje ili kuzidi 2

4. Bado katika Microsoft Visual Msingi kwa Maombi dirisha, bonyeza zana > Marejeo kwenda Marejeo-Project1 dialog box, na angalia Maktaba ya Kitufe cha Microsoft Excel chaguo kutoka Marejeo Inapatikana Weka sanduku, angalia skrini:

doc barua pepe za nje ya nje ili kuzidi 3

5. Kisha bonyeza OK kifungo ili kufunga mazungumzo, na kisha uhifadhi na ufunga dirisha la msimbo.

6. Sasa, unapaswa kuanzisha upya Outlook ili kufanya msimbo huu ufanane. Kuanzia sasa, ikiwa kuna barua pepe mpya zinazofika, zitatumwa nje kwa kitabu cha kazi moja kwa moja, angalia skrini:

doc barua pepe za nje ya nje ili kuzidi 4



Kutools kwa Outlook

Zaidi ya kazi za 100 za Juu kwa Outlook 2010, 2013, 2016, 2019 na 365

skrini ya kutosha ya skrini kwa vidogo vidogo vya bendera 201812

Makala zaidi | bure Download | Tu $ 39.00 kwa mamia ya kazi

Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Jorge · 4 months ago
    I need the help about exporting Email information sent (outgoing) emails
    • To post as a guest, your comment is unpublished.
      skyyang · 4 months ago
      Hello, Jorge,
      If you want to export the sent messages from the Sent Items folder, the Kutools for Outlook's Quick Report feature can help you. You can download the Kutools for Outlook first and then apply it.