Conas ríomhphoist a easpórtáil ó iliomad fillteán / fofhillteán le barr feabhais a chur ar Outlook?
Nuair a dhéantar fillteán a onnmhairiú leis an draoi Iompórtála agus Easpórtála in Outlook, ní thacaíonn sé leis an Cuir Fofhillteáin san áireamh rogha má onnmhairíonn tú an fillteán go comhad CSV. Tógfaidh sé go leor ama agus tedious, áfach, gach fillteán a easpórtáil go comhad CSV agus ansin é a thiontú go leabhar oibre Excel de láimh. Anseo, tabharfaidh an t-alt seo VBA isteach chun ilfhillteáin agus fofhillteáin a onnmhairiú go tapa chuig leabhair oibre Excel ar a suaimhneas.
Easpórtálacha ríomhphoist iomadúla ó iliomad fillteán / fofhillteán go Excel le VBA
- Auto CC / BCC de réir rialacha agus ríomhphost á sheoladh; Auto Ar Aghaidh Ríomhphoist Il de réir rialacha; Freagra Auto gan freastalaí malairte, agus gnéithe níos uathoibríoch ...
- Rabhadh BCC - taispeáin teachtaireacht nuair a dhéanann tú iarracht gach rud a fhreagairt má tá do sheoladh ríomhphoist ar liosta BCC; Meabhraigh Nuair a bhíonn Ceangaltáin ar Iarraidh, agus gnéithe meabhrúcháin níos mó ...
- Freagra (Gach) Leis na Ceangaltáin Uile sa chomhrá poist; Freagair go leor Ríomhphost ag an am céanna; Beannacht Auto Cuir leis nuair a thabharfar freagra; Dáta agus Am Auto Cuir isteach san ábhar ...
- Uirlisí Ceangail: Auto Detach, Compress All, Rename All, Auto Save All ... Tuarascáil Thapa, Líon Ríomhphoist Roghnaithe, Bain Ríomhphoist agus Teagmhálacha Dúblacha ...
- Déanfaidh níos mó ná 100 gné chun cinn an chuid is mó de do chuid fadhbanna a réiteach in Outlook 2021 - 2010 nó Office 365. Gnéithe iomlána triail saor in aisce 60-lá.
Easpórtálacha ríomhphoist iomadúla ó iliomad fillteán / fofhillteán go Excel le VBA
Lean na céimeanna thíos le do thoil chun ríomhphoist a easpórtáil ó iliomad fillteán nó fofhillteán chuig leabhair oibre Excel le VBA in Outlook.
1. Brúigh Eile + F11 eochracha chun an fhuinneog Microsoft Visual Basic for Applications a oscailt.
2. cliceáil Ionsáigh > Modúil, agus ansin greamaigh faoi bhun chód VBA isteach i bhfuinneog nua an Mhodúil.
VBA: Easpórtáil ríomhphoist ó iliomad fillteán agus fofhillteán chuig Excel
Const MACRO_NAME = "Export Outlook Folders to Excel"
Sub ExportMain()
ExportToExcel "destination_folder_path\A.xlsx", "your_email_accouny\folder\subfolder_1"
ExportToExcel "destination_folder_path\B.xlsx", "your_email_accouny\folder\subfolder_2"
MsgBox "Process complete.", vbInformation + vbOKOnly, MACRO_NAME
End Sub
Sub ExportToExcel(strFilename As String, strFolderPath As String)
Dim olkMsg As Object
Dim olkFld As Object
Dim excApp As Object
Dim excWkb As Object
Dim excWks As Object
Dim intRow As Integer
Dim intVersion As Integer
If strFilename <> "" Then
If strFolderPath <> "" Then
Set olkFld = OpenOutlookFolder(strFolderPath)
If TypeName(olkFld) <> "Nothing" Then
intVersion = GetOutlookVersion()
Set excApp = CreateObject("Excel.Application")
Set excWkb = excApp.Workbooks.Add()
Set excWks = excWkb.ActiveSheet
'Write Excel Column Headers
With excWks
.Cells(1, 1) = "Subject"
.Cells(1, 2) = "Received"
.Cells(1, 3) = "Sender"
End With
intRow = 2
For Each olkMsg In olkFld.Items
'Only export messages, not receipts or appointment requests, etc.
If olkMsg.Class = olMail Then
'Add a row for each field in the message you want to export
excWks.Cells(intRow, 1) = olkMsg.Subject
excWks.Cells(intRow, 2) = olkMsg.ReceivedTime
excWks.Cells(intRow, 3) = GetSMTPAddress(olkMsg, intVersion)
intRow = intRow + 1
End If
Next
Set olkMsg = Nothing
excWkb.SaveAs strFilename
excWkb.Close
Else
MsgBox "The folder '" & strFolderPath & "' does not exist in Outlook.", vbCritical + vbOKOnly, MACRO_NAME
End If
Else
MsgBox "The folder path was empty.", vbCritical + vbOKOnly, MACRO_NAME
End If
Else
MsgBox "The filename was empty.", vbCritical + vbOKOnly, MACRO_NAME
End If
Set olkMsg = Nothing
Set olkFld = Nothing
Set excWks = Nothing
Set excWkb = Nothing
Set excApp = Nothing
End Sub
Public Function OpenOutlookFolder(strFolderPath As String) As Outlook.MAPIFolder
Dim arrFolders As Variant
Dim varFolder As Variant
Dim bolBeyondRoot As Boolean
On Error Resume Next
If strFolderPath = "" Then
Set OpenOutlookFolder = Nothing
Else
Do While Left(strFolderPath, 1) = "\"
strFolderPath = Right(strFolderPath, Len(strFolderPath) - 1)
Loop
arrFolders = Split(strFolderPath, "\")
For Each varFolder In arrFolders
Select Case bolBeyondRoot
Case False
Set OpenOutlookFolder = Outlook.Session.Folders(varFolder)
bolBeyondRoot = True
Case True
Set OpenOutlookFolder = OpenOutlookFolder.Folders(varFolder)
End Select
If Err.Number <> 0 Then
Set OpenOutlookFolder = Nothing
Exit For
End If
Next
End If
On Error GoTo 0
End Function
Function GetSMTPAddress(Item As Outlook.MailItem, intOutlookVersion As Integer) As String
Dim olkSnd As Outlook.AddressEntry
Dim olkEnt As Object
On Error Resume Next
Select Case intOutlookVersion
Case Is < 14
If Item.SenderEmailType = "EX" Then
GetSMTPAddress = SMTPEX(Item)
Else
GetSMTPAddress = Item.SenderEmailAddress
End If
Case Else
Set olkSnd = Item.Sender
If olkSnd.AddressEntryUserType = olExchangeUserAddressEntry Then
Set olkEnt = olkSnd.GetExchangeUser
GetSMTPAddress = olkEnt.PrimarySmtpAddress
Else
GetSMTPAddress = Item.SenderEmailAddress
End If
End Select
On Error GoTo 0
Set olkPrp = Nothing
Set olkSnd = Nothing
Set olkEnt = Nothing
End Function
Function GetOutlookVersion() As Integer
Dim arrVer As Variant
arrVer = Split(Outlook.Version, ".")
GetOutlookVersion = arrVer(0)
End Function
Function SMTPEX(olkMsg As Outlook.MailItem) As String
Dim olkPA As Outlook.propertyAccessor
On Error Resume Next
Set olkPA = olkMsg.propertyAccessor
SMTPEX = olkPA.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x5D01001E")
On Error GoTo 0
Set olkPA = Nothing
End Function
3. Déan an cód VBA thuas a choigeartú de réir mar is gá duit.
(1) Ionadaigh ceann scríbe_folder_path sa chód thuas le cosán fillteán an fhillteáin chinn scríbe sábhálfaidh tú na leabhair oibre a onnmhairítear, mar shampla C: \ Úsáideoirí \ DT168 \ Doiciméid \ TÁSTÁIL.
(2) Cuir cosáin fillteáin na bhfofhillteán in Outlook, mar shampla, in ionad do_email_accouny \ folder \ subfolder_1 agus your_email_accouny \ folder \ subfolder_2 sa chód thuas Kelly @extendoffice.com \ Bosca Isteach \ A. agus Kelly @extendoffice.com \ Bosca Isteach \ B.
4. Brúigh an F5 eochair nó cliceáil ar an Rith cnaipe chun an VBA seo a rith. Agus ansin cliceáil ar an OK cnaipe sa bhosca popping amach Export Outlook Folders go bosca dialóige Excel. Féach an pictiúr:
Agus anois déantar ríomhphoist ó gach fofhillteán nó fillteán sonraithe sa chód VBA thuas a onnmhairiú agus a shábháil i leabhair oibre Excel.
Airteagail gaolmhara
R-phoist a easpórtáil de réir raon dáta go comhad Excel nó comhad PST in Outlook
Liosta easpórtála agus priontála de na fillteáin agus na fofhillteáin uile in Outlook
Kutools for Outlook - Tugann sé 100 Gné Ard le Outlook, agus Déan an Obair i bhfad Níos Éasca!
- Auto CC / BCC de réir rialacha agus ríomhphost á sheoladh; Auto Ar Aghaidh Ríomhphoist Il de réir saincheaptha; Freagra Auto gan freastalaí malairte, agus gnéithe níos uathoibríoch ...
- Rabhadh BCC - taispeáin teachtaireacht nuair a dhéanann tú iarracht gach ceann a fhreagairt má tá do sheoladh ríomhphoist ar liosta BCC; Meabhraigh Nuair a bhíonn Ceangaltáin ar Iarraidh, agus gnéithe meabhrúcháin níos mó ...
- Freagra (Gach) Leis na Ceangaltáin Uile sa chomhrá poist; Freagair go leor Ríomhphost i soicindí; Beannacht Auto Cuir leis nuair a thabharfar freagra; Cuir Dáta leis san ábhar ...
- Uirlisí Ceangail: Bainistigh Gach Ceangaltán i ngach Ríomhphost, Auto Dícheangail, Comhbhrú Gach, Athainmnigh Uile, Sábháil Gach ... Tuarascáil Thapa, Líon Ríomhphoist Roghnaithe...
- Ríomhphoist Cumhachtacha Junk de réir saincheaptha; Bain Ríomhphoist agus Teagmhálacha Dúblacha... Cuir ar do chumas déanamh níos cliste, níos gasta agus níos fearr in Outlook.











