Skip i'r prif gynnwys

Sut i arbed e-byst Outlook yn awtomatig i yriant caled / disg?

At ddibenion gwneud copi wrth gefn, tystiolaeth gwaith, neu ddibenion eraill, efallai yr hoffech arbed e-byst Outlook i yriant caled. Mae'n hawdd arbed sawl e-bost ar ddisg gyda llusgo â llaw o Outlook i'r ddisg. Fodd bynnag, a ydych chi'n gwybod sut i arbed disg ar bob e-bost sy'n dod i mewn yn awtomatig? Bydd yr erthygl hon yn cyflwyno VBA i'w drin yn Outlook.

Arbedwch e-byst Outlook yn awtomatig i yriant caled / disg


Arbedwch e-byst Outlook yn awtomatig i yriant caled / disg

Bydd y dull hwn yn cyflwyno VBA i arbed pob e-bost sy'n dod i mewn yn Outlook yn awtomatig fel ffeil HTML unigol i'r ddisg benodol. Gwnewch fel a ganlyn:

1. Gwasgwch Alt + F11 allweddi i agor ffenestr Microsoft Visual Basic for Applications.

2. Ehangu'r Project1, a chlicio ddwywaith SesiwnOutlook i'w agor, ac yna pastiwch islaw cod VBA i mewn i ffenestr ThisOutlookSession. Gweler y screenshot:

VBA: Cadwch e-byst Outlook yn awtomatig fel ffeiliau HTML ar ddisg

Private WithEvents InboxItems As Outlook.Items
Sub Application_Startup()
Dim xNameSpace As Outlook.NameSpace
Set xNameSpace = Outlook.Application.Session
Set InboxItems = xNameSpace.GetDefaultFolder(olFolderInbox).Items
End Sub

Private Sub InboxItems_ItemAdd(ByVal objItem As Object)
Dim FSO
Dim xMailItem As Outlook.MailItem
Dim xFilePath As String
Dim xRegEx
Dim xFileName As String
On Error Resume Next
xFilePath = CreateObject("WScript.Shell").SpecialFolders(16)
xFilePath = xFilePath & "\MyEmails"
Set FSO = CreateObject("Scripting.FileSystemObject")
If FSO.FolderExists(xFilePath) = False Then
FSO.CreateFolder (xFilePath)
End If
Set xRegEx = CreateObject("vbscript.regexp")
xRegEx.Global = True
xRegEx.IgnoreCase = False
xRegEx.Pattern = "\||\/|\<|\>|""|:|\*|\\|\?"
If objItem.Class = olMail Then
Set xMailItem = objItem
xFileName = xRegEx.Replace(xMailItem.Subject, "")
xMailItem.SaveAs xFilePath & "\" & xFileName & ".html", olHTML
End If
Exit Sub
End Sub

3. Cadwch y cod VBA, ac ailgychwynwch eich Microsoft Outlook.

O hyn ymlaen, bydd pob e-bost sy'n dod i mewn yn cael ei gadw fel ffeil HTML unigol i'r ffolder “MyEmails”.

Nodiadau:
(1) Bydd y VBA hwn yn creu ffolder o'r enw “MyEmails” o dan y ffolder Dogfennau. Gallwch ddarganfod yr e-byst a arbedir yn awtomatig gyda'r llwybr ffolder hwn: C: \ Defnyddwyr \ your_user_name \ Documents \ MyEmails
(2) Bydd y VBA hwn yn gweithio gydag e-byst a dderbynnir yn ffolder Mewnflwch y cyfrif e-bost diofyn.


Erthyglau Perthnasol


Offer Cynhyrchiant Swyddfa Gorau

Kutools ar gyfer Rhagolwg - Dros 100 o Nodweddion Pwerus i Werthu Eich Outlook

🤖 Cynorthwy-ydd Post AI: E-byst pro ar unwaith gyda hud AI - un clic i atebion athrylith, tôn berffaith, meistrolaeth amlieithog. Trawsnewid e-bostio yn ddiymdrech! ...

📧 E-bostio Automation: Allan o'r Swyddfa (Ar gael ar gyfer POP ac IMAP)  /  Amserlen Anfon E-byst  /  Auto CC/BCC gan Reolau Wrth Anfon E-bost  /  Awto Ymlaen (Rheolau Uwch)   /  Auto Ychwanegu Cyfarchiad   /  Rhannwch E-byst Aml-Dderbynnydd yn Negeseuon Unigol yn Awtomatig ...

📨 Rheoli E-bost: Dwyn i gof E-byst yn Hawdd  /  Rhwystro E-byst Sgam gan Bynciau ac Eraill  /  Dileu E-byst Dyblyg  /  Chwilio Manwl  /  Cydgrynhoi Ffolderi ...

📁 Ymlyniadau ProArbed Swp  /  Swp Datgysylltu  /  Cywasgu Swp  /  Auto Achub   /  Datgysylltiad Auto  /  Cywasgiad Auto ...

🌟 Rhyngwyneb Hud: 😊Mwy o Emojis Pretty a Cŵl   /  Rhowch hwb i'ch Cynhyrchiant Outlook gyda Golygfeydd Tabbed  /  Lleihau Outlook Yn lle Cau ...

???? Rhyfeddodau un clic: Ateb Pawb ag Ymlyniadau Dod i Mewn  /   E-byst Gwrth-Gwe-rwydo  /  🕘Dangos Parth Amser yr Anfonwr ...

👩🏼‍🤝‍👩🏻 Cysylltiadau a Chalendr: Swp Ychwanegu Cysylltiadau O E-byst Dethol  /  Rhannwch Grŵp Cyswllt i Grwpiau Unigol  /  Dileu Atgoffa Pen-blwydd ...

Dros Nodweddion 100 Aros Eich Archwiliad! Cliciwch Yma i Ddarganfod Mwy.

 

 

Comments (6)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I need to change the folder for one i created (no need folder inbox), and i need to change the folder to store the msg files, in my case in drive e:., thank!!!
This comment was minimized by the moderator on the site
Can i have a certain report that is emailed to me each week save to a place on my hard drive? Just this one email. Comes from same email address and has the same title each week.
This comment was minimized by the moderator on the site
Could you advise how to change this to another folder, not the Inbox?
This comment was minimized by the moderator on the site
Dzień doby, robię wszystko tak jak opisane powyżej, mimo to makro nie chce działać. Czy muszę włączyć jakieś opcję albo zmienić coś w kodzie?
Nie wywala błędu jednak nie tworzy się folder a plik się nie zapisuje.

Będę bardzo wdzięczna za odpowiedź

Pozdrawiam serdecznie
This comment was minimized by the moderator on the site
How can I add the sender's email address to the file name?
This comment was minimized by the moderator on the site
Buonasera, è possibile modificare questo script con una versione che prevede di spostare i messaggi che arrivano in altra cartella anzichè quella classica della posta in arrivo? In altri termini, vorrei salvare automaticamente le mail che arrivano per esempio in Posta in Arrivo\Cliente1
grazie per la collaborazione
max
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations