Μετάβαση στο κύριο περιεχόμενο

Πώς να αντιγράψετε τη δομή φακέλων του Outlook στην επιφάνεια εργασίας (windows explorer);

Όπως γνωρίζετε, μπορούμε να εφαρμόσουμε τη δυνατότητα αρχειοθέτησης για να αντιγράψετε τη δομή φακέλων σε άλλο Outlook, αλλά γνωρίζετε πώς να αντιγράψετε τη δομή φακέλων του Outlook σε έναν συγκεκριμένο φάκελο παραθύρου, όπως στην επιφάνεια εργασίας; Αυτό το άρθρο θα εισαγάγει ένα VBA για την εύκολη αντιγραφή της δομής φακέλων του Outlook στον Windows Explorer.

Αντιγράψτε τη δομή φακέλων του Outlook στην επιφάνεια εργασίας (windows explorer)

Καρτέλα Office - Ενεργοποιήστε την επεξεργασία με καρτέλες και την περιήγηση στο Microsoft Office, κάνοντας την εργασία άνετη
Kutools for Outlook - Ενισχύστε το Outlook με 100+ προηγμένες δυνατότητες για ανώτερη απόδοση
Ενισχύστε το Outlook 2021 - 2010 ή το Outlook 365 με αυτές τις προηγμένες δυνατότητες. Απολαύστε μια ολοκληρωμένη δωρεάν δοκιμή 60 ημερών και αναβαθμίστε την εμπειρία ηλεκτρονικού ταχυδρομείου σας!

Αντιγράψτε τη δομή φακέλων του Outlook στην επιφάνεια εργασίας (windows explorer)

Ακολουθήστε τα παρακάτω βήματα για να αντιγράψετε τη δομή φακέλων του Outlook στην επιφάνεια εργασίας ή στον εξερευνητή παραθύρων.

1. Στο παράθυρο περιήγησης, κάντε κλικ για να επισημάνετε τον καθορισμένο φάκελο του οποίου η δομή φακέλων θα αντιγράψετε και πατήστε άλλος + F11 για να ανοίξετε το παράθυρο της Microsoft Visual Basic for Applications.

2. κλικ Εργαλεία > αναφορές για να ανοίξετε το πλαίσιο διαλόγου Αναφορές. Στη συνέχεια, στο πλαίσιο διαλόγου επιλέξτε το Χρόνος εκτέλεσης δέσμης ενεργειών Microsoft και κάντε κλικ στο OK κουμπί. Δείτε το στιγμιότυπο οθόνης:

3. κλικ Κύριο θέμα > Μονάδα μέτρησηςκαι αντιγράψτε και επικολλήστε κάτω από τον κώδικα VBA στο νέο παράθυρο λειτουργικής μονάδας.

VBA: Αντιγράψτε τη δομή φακέλων του Outlook στον Windows Explorer

Dim xFSO As Scripting.FileSystemObject
Sub CopyOutlookFldStructureToWinExplorer()
    ExportAction "Copy"
End Sub
  
Sub ExportAction(xAction As String)
Dim xFolder As Outlook.Folder
Dim xFldPath As String
xFldPath = SelectAFolder()
If xFldPath = "" Then
    MsgBox "You did not select a folder. Export cancelled.", vbInformation + vbOKOnly, "Kutools for Outlook"
Else
    Set xFSO = New Scripting.FileSystemObject
    Set xFolder = Outlook.Application.ActiveExplorer.CurrentFolder
    ExportOutlookFolder xFolder, xFldPath
End If
Set xFolder = Nothing
Set xFSO = Nothing
End Sub

Sub ExportOutlookFolder(ByVal OutlookFolder As Outlook.Folder, xFldPath As String)
Dim xSubFld As Outlook.Folder
Dim xItem As Object
Dim xPath As String
Dim xFilePath As String
Dim xSubject As String
Dim xCount As Integer
Dim xFilename As String
On Error Resume Next
xPath = xFldPath & "\" & OutlookFolder.Name
'?????????,??????
If Dir(xPath, 16) = Empty Then MkDir xPath
For Each xItem In OutlookFolder.Items
    xSubject = ReplaceInvalidCharacters(xItem.Subject)
    xFilename = xSubject & ".msg"
    xCount = 0
    xFilePath = xPath & "\" & xFilename
    If xFSO.FileExists(xFilePath) Then
        xCount = xCount + 1
        xFilename = xSubject & " (" & xCount & ").msg"
        xFilePath = xPath & "\" & xFilename
    End If
    xItem.SaveAs xFilePath, olMSG
Next
For Each xSubFld In OutlookFolder.Folders
    ExportOutlookFolder xSubFld, xPath
Next
Set OutlookFolder = Nothing
Set xItem = Nothing
End Sub

Function SelectAFolder() As String
Dim xSelFolder As Object
Dim xShell As Object
On Error Resume Next
Set xShell = CreateObject("Shell.Application")
Set xSelFolder = xShell.BrowseForFolder(0, "Select a folder", 0, 0)
If Not TypeName(xSelFolder) = "Nothing" Then
    SelectAFolder = xSelFolder.self.Path
End If
Set xSelFolder = Nothing
Set xShell = Nothing
End Function
  
Function ReplaceInvalidCharacters(Str As String) As String
Dim xRegEx
Set xRegEx = CreateObject("vbscript.regexp")
xRegEx.Global = True
xRegEx.IgnoreCase = False
xRegEx.Pattern = "\||\/|\<|\>|""|:|\*|\\|\?"
ReplaceInvalidCharacters = xRegEx.Replace(Str, "")
End Function

4. Τύπος F5 ή κάντε κλικ στο τρέξιμο για να εκτελέσετε αυτό το VBA.

5. Στο αναδυόμενο παράθυρο διαλόγου Αναζήτηση για φάκελο, επιλέξτε τον καθορισμένο φάκελο στον οποίο θα τοποθετήσετε τη δομή του αντιγραμμένου φακέλου και κάντε κλικ στο OK κουμπί. Δείτε το στιγμιότυπο οθόνης:

Τώρα μεταβείτε στον καθορισμένο φάκελο, θα δείτε ότι η δομή του φακέλου αντιγράφεται στον καθορισμένο σκληρό δίσκο. Δείτε στιγμιότυπο οθόνης:

Note: τα στοιχεία φακέλου, όπως email, συναντήσεις, εργασίες κ.λπ. αντιγράφονται επίσης σε αντίστοιχους φακέλους στον σκληρό δίσκο.


Σχετικά άρθρα


Τα καλύτερα εργαλεία παραγωγικότητας γραφείου

Kutools για το Outlook - Πάνω από 100 ισχυρές δυνατότητες για υπερφόρτιση του Outlook σας

🤖 Βοηθός αλληλογραφίας AI: Άμεσα επαγγελματικά email με μαγεία AI -- με ένα κλικ για ιδιοφυείς απαντήσεις, τέλειος τόνος, πολυγλωσσική γνώση. Μεταμορφώστε τα email χωρίς κόπο! ...

📧 Αυτοματοποίηση ηλεκτρονικού ταχυδρομείου: Εκτός γραφείου (Διαθέσιμο για POP και IMAP)  /  Προγραμματισμός αποστολής email  /  Αυτόματο CC/BCC βάσει κανόνων κατά την αποστολή email  /  Αυτόματη προώθηση (Σύνθετοι κανόνες)   /  Αυτόματη προσθήκη χαιρετισμού   /  Διαχωρίστε αυτόματα τα μηνύματα ηλεκτρονικού ταχυδρομείου πολλών παραληπτών σε μεμονωμένα μηνύματα ...

📨 Διαχείριση e-mail: Εύκολη ανάκληση email  /  Αποκλεισμός απάτης email από υποκείμενα και άλλους  /  Διαγραφή διπλότυπων μηνυμάτων ηλεκτρονικού ταχυδρομείου  /  Προχωρημένη Αναζήτηση  /  Ενοποίηση φακέλων ...

📁 Συνημμένα ProΜαζική αποθήκευση  /  Αποσύνδεση παρτίδας  /  Συμπίεση παρτίδας  /  Αυτόματη αποθήκευση   /  Αυτόματη απόσπαση  /  Αυτόματη συμπίεση ...

🌟 Διασύνδεση Magic: 😊Περισσότερα όμορφα και δροσερά emojis   /  Ενισχύστε την παραγωγικότητά σας στο Outlook με προβολές με καρτέλες  /  Ελαχιστοποιήστε το Outlook αντί να κλείσετε ...

???? Με ένα κλικ Wonders: Απάντηση σε όλους με εισερχόμενα συνημμένα  /   Email κατά του phishing  /  🕘Εμφάνιση ζώνης ώρας αποστολέα ...

👩🏼‍🤝‍👩🏻 Επαφές & Ημερολόγιο: Μαζική προσθήκη επαφών από επιλεγμένα μηνύματα ηλεκτρονικού ταχυδρομείου  /  Διαχωρίστε μια ομάδα επαφής σε μεμονωμένες ομάδες  /  Κατάργηση υπενθυμίσεων γενεθλίων ...

Διανεμήθηκαν παραπάνω από 100 Χαρακτηριστικά Περιμένετε την εξερεύνηση σας! Κάντε κλικ εδώ για να ανακαλύψετε περισσότερα.

 

 

Comments (16)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hello, that's brilliant! How can I adjust the code to only save email attachments, not the entire message? Many thanks
This comment was minimized by the moderator on the site
'This code solves the duplicate filename problemDim xFSO As Scripting.FileSystemObject
Sub CopyOutlookFldStructureToWinExplorer()
ExportAction "Copy"
End Sub

Sub ExportAction(xAction As String)
Dim xFolder As Outlook.Folder
Dim xFldPath As String
xFldPath = SelectAFolder()
If xFldPath = "" Then
MsgBox "You did not select a folder. Export cancelled.", vbInformation + vbOKOnly, "Kutools for Outlook"
Else
Set xFSO = New Scripting.FileSystemObject
Set xFolder = Outlook.Application.ActiveExplorer.CurrentFolder
ExportOutlookFolder xFolder, xFldPath
End If
Set xFolder = Nothing
Set xFSO = Nothing
End Sub

Sub ExportOutlookFolder(ByVal OutlookFolder As Outlook.Folder, xFldPath As String)
Dim xSubFld As Outlook.Folder
Dim xItem As Object
Dim xPath As String
Dim xFilePath As String
Dim xSubject As String
Dim xCount As Integer
Dim xFilename As String
On Error Resume Next
xPath = xFldPath & "\" & OutlookFolder.Name
'?????????,??????
If Dir(xPath, 16) = Empty Then MkDir xPath

xCount = 0

For Each xItem In OutlookFolder.Items
xSubject = ReplaceInvalidCharacters(xItem.Subject)
xFilename = xSubject & ".msg"
xFilePath = xPath & "\" & xFilename
If xFSO.FileExists(xFilePath) Then
xCount = xCount + 1
xFilename = xSubject & " (" & xCount & ").msg"
xFilePath = xPath & "\" & xFilename
While xFSO.FileExists(xFilePath)
xCount = xCount + 1
xFilename = xSubject & " (" & xCount & ").msg"
xFilePath = xPath & "\" & xFilename
Wend
End If
xItem.SaveAs xFilePath, olMSG
xCount = 0
Next
For Each xSubFld In OutlookFolder.Folders
ExportOutlookFolder xSubFld, xPath
Next
Set OutlookFolder = Nothing
Set xItem = Nothing
End Sub

Function SelectAFolder() As String
Dim xSelFolder As Object
Dim xShell As Object
On Error Resume Next
Set xShell = CreateObject("Shell.Application")
Set xSelFolder = xShell.BrowseForFolder(0, "Select a folder", 0, 0)
If Not TypeName(xSelFolder) = "Nothing" Then
SelectAFolder = xSelFolder.self.Path
End If
Set xSelFolder = Nothing
Set xShell = Nothing
End Function

Function ReplaceInvalidCharacters(Str As String) As String
Dim xRegEx
Set xRegEx = CreateObject("vbscript.regexp")
xRegEx.Global = True
xRegEx.IgnoreCase = False
xRegEx.Pattern = "\||\/|\<|\>|""|:|\*|\\|\?"
ReplaceInvalidCharacters = xRegEx.Replace(Str, "")
End Function
This comment was minimized by the moderator on the site
Here is how i modified the code to make it work

i will paste it in reply
This comment was minimized by the moderator on the site
Dim xFSO As Scripting.FileSystemObject
Sub CopyOutlookFldStructureToWinExplorer()
ExportAction "Copy"
msg = MsgBox("Copy of your Inbox is successful", vbOKOnly, "Done")
End Sub

Sub ExportAction(xAction As String)
Dim xFolder As Outlook.Folder
Dim xFldPath As String
xFldPath = SelectAFolder()
If xFldPath = "" Then
MsgBox "You did not select a folder. Export cancelled.", vbInformation + vbOKOnly, "Kutools for Outlook"
Else
Set xFSO = New Scripting.FileSystemObject
Set xFolder = Outlook.Application.ActiveExplorer.CurrentFolder
ExportOutlookFolder xFolder, xFldPath
End If
Set xFolder = Nothing
Set xFSO = Nothing
End Sub

Sub ExportOutlookFolder(ByVal OutlookFolder As Outlook.Folder, xFldPath As String)
Dim xSubFld As Outlook.Folder
Dim xItem As Object
Dim xPath As String
Dim xFilePath As String
Dim xSubject As String * 100

Dim xCounter As Integer
Dim xFilename As String
Dim xFileDateRec As String

On Error Resume Next
xPath = xFldPath & "\" & ReplaceInvalidCharacters(OutlookFolder.Name)

If Dir(xPath, 16) = Empty Then MkDir xPath
xCounter = 0

For Each xItem In OutlookFolder.Items
xCounter = xCounter + 1
xSubject = ReplaceInvalidCharacters(xItem.Subject)
xFileDateRec = xItem.ReceivedTime
xFilename = ReplaceInvalidCharacters(RTrim(xSubject) & xFileDateRec & " " & xCounter & ".msg")
xFilePath = xPath & "\" & xFilename
xItem.SaveAs xFilePath, olMSG
Next
For Each xSubFld In OutlookFolder.Folders
ExportOutlookFolder xSubFld, xPath
Next
Set OutlookFolder = Nothing
Set xItem = Nothing
End Sub

Function SelectAFolder() As String
Dim xSelFolder As Object
Dim xShell As Object
On Error Resume Next
Set xShell = CreateObject("Shell.Application")
Set xSelFolder = xShell.BrowseForFolder(0, "Select a folder", 0, 0)
If Not TypeName(xSelFolder) = "Nothing" Then
SelectAFolder = xSelFolder.self.Path
End If
Set xSelFolder = Nothing
Set xShell = Nothing
End Function

Function ReplaceInvalidCharacters(Str As String) As String
Dim xRegEx
Set xRegEx = CreateObject("vbscript.regexp")
xRegEx.Global = True
xRegEx.IgnoreCase = False
xRegEx.Pattern = "\||\/|\<|\>|""|:|\*|\\|\?"
ReplaceInvalidCharacters = xRegEx.Replace(Str, "_")
End Function
This comment was minimized by the moderator on the site
If I re-run this VBA every couple months, does it only copy new email or does it copy new email and create duplicates for all existing emails?
This comment was minimized by the moderator on the site
xItem.SaveAs xFilePath, olMSG
Next
For Each xSubFld In OutlookFolder.Folders
ExportOutlookFolder xSubFld, xPath
Next
Set OutlookFolder = Nothing
Set xItem = Nothing
End Sub

Function SelectAFolder() As String
Dim xSelFolder As Object
Dim xShell As Object
On Error Resume Next
Set xShell = CreateObject("Shell.Application")
Set xSelFolder = xShell.BrowseForFolder(0, "Select a folder", 0, 0)
If Not TypeName(xSelFolder) = "Nothing" Then
SelectAFolder = xSelFolder.self.Path
End If
Set xSelFolder = Nothing
Set xShell = Nothing
End Function

Function ReplaceInvalidCharacters(Str As String) As String
Dim xRegEx
Set xRegEx = CreateObject("vbscript.regexp")
xRegEx.Global = True
xRegEx.IgnoreCase = False
xRegEx.Pattern = "\||\/|\<|\>|""|:|\*|\\|\?"
ReplaceInvalidCharacters = xRegEx.Replace(Str, "_")
End Function
This comment was minimized by the moderator on the site
What is this second piece of code? Do I use the original reply code or the second reply and that?
This comment was minimized by the moderator on the site
it is all 1 code, it was too long to post in 1 piece
This comment was minimized by the moderator on the site
hello, same thing. you code works great.. the only thing is that the duplicate names, more than (1), are not exported.
Please add the option.
This comment was minimized by the moderator on the site
Yes! the same as Ammar asked, can you modify the code so it copies every item even if it has the same name!!! this would help me a lot
This comment was minimized by the moderator on the site
Hello I have one question, I used the above mentioned code, but it is missing the related conversations as it has the same subject. This is created problem as the numbers of items in outlook not matching with number of items in folder. Can you please help to edit the above code so that it also paste all the items even though it has same subject ?
This comment was minimized by the moderator on the site
Dim xFSO As Scripting.FileSystemObject
Sub CopyOutlookFldStructureToWinExplorer()
ExportAction "Copy"
End Sub

Sub ExportAction(xAction As String)
Dim xFolder As Outlook.Folder
Dim xFldPath As String
xFldPath = SelectAFolder()
If xFldPath = "" Then
MsgBox "You did not select a folder. Export cancelled.", vbInformation + vbOKOnly, "Kutools for Outlook"
Else
Set xFSO = New Scripting.FileSystemObject
Set xFolder = Outlook.Application.ActiveExplorer.CurrentFolder
ExportOutlookFolder xFolder, xFldPath
End If
Set xFolder = Nothing
Set xFSO = Nothing
End Sub

Sub ExportOutlookFolder(ByVal OutlookFolder As Outlook.Folder, xFldPath As String)
Dim xSubFld As Outlook.Folder
Dim xItem As Object
Dim xPath As String
Dim xFilePath As String
Dim xSubject As String
Dim xCount As Integer
Dim xFilename As String
On Error Resume Next
xPath = xFldPath & "\" & OutlookFolder.Name
'?????????,??????
If Dir(xPath, 16) = Empty Then MkDir xPath
xCount = 0 ' Pasted lineFor Each xItem In OutlookFolder.Items
xSubject = ReplaceInvalidCharacters(xItem.Subject)
xFilename = xSubject & ".msg"
' Deleted line xCount = 0
xFilePath = xPath & "\" & xFilename
If xFSO.FileExists(xFilePath) Then
xCount = xCount + 1
xFilename = xSubject & " (" & xCount & ").msg"
xFilePath = xPath & "\" & xFilename
Else ' New linexCount = 0 ' New line E xItem.SaveAs xFilePath, olMSG
Next
For Each xSubFld In OutlookFolder.Folders
ExportOutlookFolder xSubFld, xPath
Next
Set OutlookFolder = Nothing
Set xItem = Nothing
End Sub

Function SelectAFolder() As String
Dim xSelFolder As Object
Dim xShell As Object
On Error Resume Next
Set xShell = CreateObject("Shell.Application")
Set xSelFolder = xShell.BrowseForFolder(0, "Select a folder", 0, 0)
If Not TypeName(xSelFolder) = "Nothing" Then
SelectAFolder = xSelFolder.self.Path
End If
Set xSelFolder = Nothing
Set xShell = Nothing
End Function

Function ReplaceInvalidCharacters(Str As String) As String
Dim xRegEx
Set xRegEx = CreateObject("vbscript.regexp")
xRegEx.Global = True
xRegEx.IgnoreCase = False
xRegEx.Pattern = "\||\/|\<|\>|""|:|\*|\\|\?"
ReplaceInvalidCharacters = xRegEx.Replace(Str, "")
End Function
This comment was minimized by the moderator on the site
This is great, thank you! What would the code look like if I just want Inbox + all subfolders? (i.e., exclude deleted items?)Thank you!Morghan
This comment was minimized by the moderator on the site
It works (sort of), but (a) there were more messages exported to one folder than were in the corresponding Outlook Folder and (b) there were fewer messages exported to one folder than were in the Outlook Folder and (c) (not 100% sure) I think one message went to the wrong folder.
This comment was minimized by the moderator on the site
I have Outlook 15, and the macro won't replace the "/" where used in Outlook folder names. It just skips those folders. Is this a compatibility issue?
This comment was minimized by the moderator on the site
Bonjour,

Serait-il possible de stocker les mails dans un fichier .pst ?

D'avance merci pour vos retours.

Cordialement,

Ando Rakotomalala
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations