Բաց թողնել հիմնական բովանդակությունը

Ինչպե՞ս փրկել բոլոր կցորդները բազմաթիվ նամակներից Outlook- ի թղթապանակ:

Outlook- ում ներկառուցված «Պահիր բոլոր կցորդները» հնարավորությամբ հեշտ է պահպանել բոլոր կցորդները էլփոստից: Այնուամենայնիվ, եթե ցանկանում եք միանգամից միացնել բազմաթիվ կցորդները մի քանի նամակներից, ապա որևէ ուղղակի հատկություն չի կարող օգնել: Դուք պետք է բազմիցս կիրառեք Save all Attachments հատկությունը յուրաքանչյուր էլփոստի մեջ, մինչև բոլոր կցորդները պահվեն այդ էլ-նամակներից: Դա ժամանակատար է: Այս հոդվածում մենք ձեզ համար ներկայացնում ենք երկու մեթոդ `Outlook- ում հեշտությամբ բոլոր կցորդները բազմաթիվ նամակներից որոշակի թղթապանակ պահելու համար:

Պահեք բոլոր կցորդները բազմաթիվ նամակներից VBA կոդով թղթապանակ
Մի քանի կտտոց ՝ զարմանալի գործիքով բազմաթիվ կցորդներ բազմաթիվ նամակներից թղթապանակ պահելու համար


Պահեք բոլոր կցորդները բազմաթիվ նամակներից VBA կոդով թղթապանակ

Այս բաժինը ցույց է տալիս VBA կոդը քայլ առ քայլ ուղեցույցում, որը կօգնի ձեզ միանգամից պահպանել բոլոր կցորդները մի քանի նամակներից որոշակի թղթապանակում: Խնդրում եմ, արեք հետևյալ կերպ.

1. Նախ, անհրաժեշտ է ստեղծել թղթապանակ ձեր համակարգչում հավելվածները փրկելու համար:

Մտեք մեջ Փաստաթղթեր թղթապանակ և ստեղծեք անունով պանակ «Կցորդներ»: Տեսեք,

2. Ընտրեք այն էլ-նամակները, որոնք կփրկեք ձեր կցորդները և այնուհետև սեղմեք ալտ + F11 բացել ստեղները Microsoft Visual Basic հավելվածների համար պատուհան.

3: սեղմեք Տեղադրել > Մոդուլներ բացելու համար Մոդուլներ պատուհանում, ապա պատուհանում պատճենել հետևյալ VBA կոդերից մեկը:

VBA կոդ 1. Կցորդները զանգվածաբար խնայել են բազմաթիվ նամակներից (ուղղակիորեն պահպանեք նույն անունի կցորդները ուղղակիորեն)

TipsԱյս ծածկագիրը կփրկի ճիշտ նույնանուն կցորդները ՝ ֆայլերի անուններից հետո ավելացնելով 1, 2, 3 ... թվանշաններ:

Dim GCount As Integer
Dim GFilepath As String
Public Sub SaveAttachments()
'Update 20200821
Dim xMailItem As Outlook.MailItem
Dim xAttachments As Outlook.Attachments
Dim xSelection As Outlook.Selection
Dim i As Long
Dim xAttCount As Long
Dim xFilePath As String, xFolderPath As String, xSaveFiles As String
On Error Resume Next
xFolderPath = CreateObject("WScript.Shell").SpecialFolders(16)
Set xSelection = Outlook.Application.ActiveExplorer.Selection
xFolderPath = xFolderPath & "\Attachments\"
If VBA.Dir(xFolderPath, vbDirectory) = vbNullString Then
    VBA.MkDir xFolderPath
End If
GFilepath = ""
For Each xMailItem In xSelection
    Set xAttachments = xMailItem.Attachments
    xAttCount = xAttachments.Count
    xSaveFiles = ""
    If xAttCount > 0 Then
        For i = xAttCount To 1 Step -1
            GCount = 0
            xFilePath = xFolderPath & xAttachments.Item(i).FileName
            GFilepath = xFilePath
            xFilePath = FileRename(xFilePath)
            If IsEmbeddedAttachment(xAttachments.Item(i)) = False Then
                xAttachments.Item(i).SaveAsFile xFilePath
                If xMailItem.BodyFormat <> olFormatHTML Then
                    xSaveFiles = xSaveFiles & vbCrLf & "<Error! Hyperlink reference not valid.>"
                Else
                    xSaveFiles = xSaveFiles & "<br>" & "<a href='file://" & xFilePath & "'>" & xFilePath & "</a>"
                End If
            End If
        Next i
    End If
Next
Set xAttachments = Nothing
Set xMailItem = Nothing
Set xSelection = Nothing
End Sub

Function FileRename(FilePath As String) As String
Dim xPath As String
Dim xFso As FileSystemObject
On Error Resume Next
Set xFso = CreateObject("Scripting.FileSystemObject")
xPath = FilePath
FileRename = xPath
If xFso.FileExists(xPath) Then
    GCount = GCount + 1
    xPath = xFso.GetParentFolderName(GFilepath) & "\" & xFso.GetBaseName(GFilepath) & " " & GCount & "." + xFso.GetExtensionName(GFilepath)
    FileRename = FileRename(xPath)
End If
xFso = Nothing
End Function

Function IsEmbeddedAttachment(Attach As Attachment)
Dim xItem As MailItem
Dim xCid As String
Dim xID As String
Dim xHtml As String
On Error Resume Next
IsEmbeddedAttachment = False
Set xItem = Attach.Parent
If xItem.BodyFormat <> olFormatHTML Then Exit Function
xCid = ""
xCid = Attach.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001F")
If xCid <> "" Then
    xHtml = xItem.HTMLBody
    xID = "cid:" & xCid
    If InStr(xHtml, xID) > 0 Then
        IsEmbeddedAttachment = True
    End If
End If
End Function
VBA կոդ 2. Mentsանգվածային խնայել կցորդները բազմաթիվ էլ-նամակներից (ստուգեք կրկնօրինակների համար)
Public Sub SaveAttachments()
'Update 20200821
Dim xMailItem As Outlook.MailItem
Dim xAttachments As Outlook.Attachments
Dim xSelection As Outlook.Selection
Dim i As Long
Dim xAttCount As Long
Dim xFilePath As String, xFolderPath As String, xSaveFiles As String
Dim xYesNo As Integer
Dim xFlag As Boolean
On Error Resume Next
xFolderPath = CreateObject("WScript.Shell").SpecialFolders(16)
Set xSelection = Outlook.Application.ActiveExplorer.Selection
xFolderPath = xFolderPath & "\Attachments\"
If VBA.Dir(xFolderPath, vbDirectory) = vbNullString Then
    VBA.MkDir xFolderPath
End If
For Each xMailItem In xSelection
    Set xAttachments = xMailItem.Attachments
    xAttCount = xAttachments.Count
    xSaveFiles = ""
    If xAttCount > 0 Then
        For i = xAttCount To 1 Step -1
            xFilePath = xFolderPath & xAttachments.Item(i).FileName
            xFlag = True
            If VBA.Dir(xFilePath, 16) <> Empty Then
                xYesNo = MsgBox("The file is exists, do you want to replace it", vbYesNo + vbInformation, "Kutools for Outlook")
                If xYesNo = vbNo Then xFlag = False
            End If
            If xFlag = True Then
                xAttachments.Item(i).SaveAsFile xFilePath
                If xMailItem.BodyFormat <> olFormatHTML Then
                    xSaveFiles = xSaveFiles & vbCrLf & "<Error! Hyperlink reference not valid.>"
                Else
                    xSaveFiles = xSaveFiles & "<br>" & "<a href='file://" & xFilePath & "'>" & xFilePath & "</a>"
                End If
            End If
        Next i
    End If
Next
Set xAttachments = Nothing
Set xMailItem = Nothing
Set xSelection = Nothing
End Sub

Notes:

1) Եթե ցանկանում եք թղթապանակում պահպանել բոլոր նույնանուն կցորդները, խնդրում ենք կիրառել վերը նշվածը VBA կոդ 1, Այս կոդը գործարկելուց առաջ սեղմեք Գործիքներ > Սայլակ, ապա ստուգեք Microsoft Scripting Runtime տուփի մեջ Հղումներ - Նախագիծ երկխոսության տուփ;

փաստաթուղթ պահպանել կցորդները 07

2) Եթե ցանկանում եք ստուգել կցորդի կրկնօրինակ անունները, խնդրում ենք կիրառել VBA կոդը 2. Կոդը գործարկելուց հետո կհայտնվի երկխոսություն ՝ հիշեցնելու համար, արդյոք փոխարինել կրկնօրինակ կցորդները, ընտրեք այո or Ոչ հիման վրա ձեր կարիքները.

5. Սեղմեք F5 ծածկագիրը գործելու համար:

Այնուհետև ընտրված էլփոստի բոլոր հավելվածները պահվում են 1-ին քայլում ձեր ստեղծած թղթապանակում: 

Նշումներ: Կարող է լինել ա Microsoft Outlook արագ վանդակը հայտնվում է, սեղմեք Թույլ տալ առաջ գնալու կոճակը:


Saveարմանալի գործիքով պահեք բոլոր կցորդները բազմաթիվ նամակներից թղթապանակ պահելու համար

Եթե ​​դուք VBA- ի նորեկ եք, այստեղ մեծապես խորհուրդ է տրվում Պահել բոլոր կցորդները օգտակարությունը Կոշուլսներ Outook- ի համար քեզ համար. Այս օգտակար ծառայության միջոցով դուք կարող եք արագորեն պահպանել բոլոր կցորդները միանգամից բազմաթիվ էլ-նամակներից `մի քանի կտտոցով միայն Outlook- ում:
Նախքան գործառույթը կիրառելը, խնդրում եմ առաջին հերթին ներբեռնեք և տեղադրեք Kutools Outlook- ի համար.

1. Ընտրեք այն նամակները, որոնք պարունակում են կցորդներ, որոնք ցանկանում եք պահպանել:

Հուշում. Կարող եք ընտրել բազմաթիվ ոչ հարակից էլ-նամակներ ՝ պահելով այն Ctrl բանալին և ընտրեք դրանք մեկ առ մեկ;
Կամ ընտրեք հարակից բազմաթիվ նամակներ ՝ պահելով այն Հերթափոխություն բանալին և ընտրեք առաջին էլ. փոստը և վերջինը:

2: սեղմեք Կուտոլս >Կցման գործիքներՊահել բոլորը, Տեսեք,

3. Մեջ Պահել Կառավարում երկխոսություն, կտտացրեք կցորդները պահելու համար պանակ ընտրելու կոճակը և այնուհետև կտտացրեք այն OK կոճակը:

3: սեղմեք OK երկու անգամ հաջորդ բացվող երկխոսության դաշտում, ապա ընտրված էլփոստի բոլոր կցորդները պահվում են միանգամից նշված թղթապանակում:

Նշումներ:

  • 1. Եթե ուզում եք կցորդները տարբեր թղթապանակներում պահպանել էլ-նամակների հիման վրա, խնդրում ենք ստուգել Ստեղծեք ենթապանակներ հետևյալ ոճով տուփը և բացվող պատուհանից ընտրեք պանակի ոճը:
  • 2. Բացի բոլոր կցորդները պահպանելուց, կցորդները կարող եք պահպանել ըստ հատուկ պայմանների: Օրինակ, դուք ցանկանում եք պահպանել միայն pdf ֆայլի կցորդները, որոնց ֆայլի անունը պարունակում է «Հաշիվ» բառը, խնդրում ենք սեղմել Ընդլայնված ընտրանքներ պայմանները ընդլայնելու կոճակը և այնուհետև կազմաձևել, ինչպես ցույց է տրված ստորև նկարված նկարը:
  • 3. Եթե ցանկանում եք ավտոմատ կերպով պահպանել կցորդները էլեկտրոնային փոստի ժամանելիս, ապա Ավտոմատ պահեք կցորդները հատկությունը կարող է օգնել:
  • 4. Կցորդներն անմիջապես ընտրված էլ-նամակներից անջատելու համար Անջատել բոլոր կցորդները առանձնահատկությունը Outlook- ի համար նախատեսված գործիքներ կարող է ձեզ բարեհաճություն դրսեւորել:

  Եթե ​​ցանկանում եք ունենալ այս օգտակար ծառայության անվճար փորձարկում (60-օրյա), խնդրում ենք կտտացնել այն ներբեռնելու համար, և այնուհետև անցեք գործողությունը կիրառելու վերը նշված քայլերին համապատասխան:


Առնչվող հոդվածներ

Outlook- ում էլփոստի հաղորդագրության մարմնում կցորդներ տեղադրեք
Սովորաբար կցորդները ցուցադրվում են Կցված դաշտում ՝ կազմելով էլ. Փոստ: Այստեղ այս ձեռնարկը տրամադրում է մեթոդներ, որոնք կօգնեն ձեզ հեշտությամբ հավելվածներ ներդնել էլփոստի մարմնում Outlook- ում:

Ավտոմատ կերպով ներբեռնեք / պահեք հավելվածները Outlook- ից որոշակի թղթապանակ
Ընդհանուր առմամբ, դուք կարող եք պահպանել մեկ էլփոստի բոլոր կցորդները կտտացնելով Կցորդներ> Պահել բոլոր կցորդները Outlook- ում: Բայց, եթե Ձեզ անհրաժեշտ է բոլոր կցորդները պահպանել ստացված բոլոր էլ-նամակներից և էլ. Նամակներ ստանալուց, որևէ իդեալ: Այս հոդվածը կներկայացնի երկու լուծում `Outlook- ից որոշակի թղթապանակում կցորդները ավտոմատ կերպով ներբեռնելու համար:

Տպեք բոլոր կցորդները մեկ / մի քանի էլփոստով Outlook- ում
Ինչպես գիտեք, այն միայն կտպագրի էլփոստի բովանդակությունը, ինչպիսիք են վերնագիրը, մարմինը, երբ կտտացնում եք Ֆայլ> Տպել Microsoft Outlook- ում, բայց չի տպելու կցորդները: Այստեղ մենք ձեզ ցույց կտանք, թե ինչպես տպել բոլոր կցորդները ընտրված էլփոստում `Microsoft Outlook- ում հեշտությամբ:

Outlook- ում կցորդի (բովանդակության) շրջանակներում որոնեք բառերը
Երբ մենք Outlook- ի Ակնթարթային որոնման դաշտում բանալի բառ ենք մուտքագրում, այն կփնտրի հիմնաբառը էլեկտրոնային փոստի թեմաներում, մարմիններում, հավելվածներում և այլն: Բայց հիմա ես պարզապես պետք է որոնել հավելվածի բովանդակության հիմնաբառը միայն Outlook- ում, գաղափար կա՞: Այս հոդվածը ցույց է տալիս Outlook- ի հավելվածի բովանդակության մեջ հեշտությամբ բառեր որոնելու մանրամասն քայլերը:

Outlook- ում պատասխանելիս պահեք կցորդները
Երբ մենք Microsoft Outlook- ում էլեկտրոնային հաղորդագրություն ենք փոխանցում, այս էլ.փոստի բնօրինակ հավելվածները մնում են փոխանցված հաղորդագրության մեջ: Այնուամենայնիվ, երբ մենք նամակ ենք պատասխանում, բնօրինակ կցորդները չեն կցվելու նոր պատասխան հաղորդագրության մեջ: Այստեղ մենք պատրաստվում ենք ներկայացնել Microsoft Outlook- ում պատասխանելիս բնօրինակ կցորդներ պահելու վերաբերյալ մի քանի հնարքներ:


Գրասենյակի արտադրողականության լավագույն գործիքները

Outlook- ի համար նախատեսված գործիքներ - Ավելի քան 100 հզոր գործառույթ՝ ձեր Outlook-ը լիցքավորելու համար

🤖 AI Փոստի օգնական: Ակնթարթային պրոֆեսիոնալ նամակներ AI մոգությամբ. մեկ սեղմումով հանճարեղ պատասխաններ, կատարյալ հնչերանգներ, բազմալեզու վարպետություն: Փոխակերպեք էլ. փոստը առանց ջանքերի: ...

📧 Email ավտոմատացում: Գրասենյակից դուրս (հասանելի է POP-ի և IMAP-ի համար)  /  Ժամանակացույց ուղարկել նամակներ  /  Ավտոմատ CC/BCC էլփոստ ուղարկելիս կանոններով  /  Ավտոմատ փոխանցում (Ընդլայնված կանոններ)   /  Ավտոմատ ավելացնել ողջույնները   /  Ավտոմատ կերպով բաժանել բազմասերիստացող նամակները առանձին հաղորդագրությունների ...

📨 էլեկտրոնային կառավարման: Հեշտությամբ հիշեք նամակները  /  Արգելափակել խարդախության նամակները ըստ առարկաների և այլոց  /  Deleteնջել կրկնօրինակ նամակները  /  Ընդլայնված որոնում  /  Համախմբել Թղթապանակները ...

📁 Հավելվածներ ProԽմբաքանակի պահպանում  /  Խմբաքանակի անջատում  /  Խմբաքանակային կոմպրես  /  Auto Save- ը   /  Ավտոմատ անջատում  /  Ավտոմատ սեղմում ...

🌟 Ինտերֆեյս Magic: 😊Ավելի գեղեցիկ և զով էմոջիներ   /  Բարձրացրեք ձեր Outlook-ի արտադրողականությունը ներդիրներով դիտումների միջոցով  /  Նվազագույնի հասցնել Outlook-ը փակելու փոխարեն ...

???? Մեկ սեղմումով Հրաշքներ: Պատասխանել բոլորին մուտքային հավելվածներով  /   Հակաֆիշինգի էլ. նամակներ  /  🕘Ցուցադրել ուղարկողի ժամային գոտին ...

👩🏼‍🤝‍👩🏻 Կոնտակտներ և օրացույց: Խմբաքանակի ավելացրեք կոնտակտներ ընտրված էլ  /  Կոնտակտային խումբը բաժանեք առանձին խմբերի  /  Հեռացնել ծննդյան հիշեցումները ...

Over 100 Նկարագրություն Սպասեք ձեր հետազոտությանը: Սեղմեք այստեղ՝ ավելին բացահայտելու համար:

 

 

Comments (81)
Rated 3.5 out of 5 · 3 ratings
This comment was minimized by the moderator on the site
Thank you for sharing the code. Unfortunately, I tried both with failure. This is what I got - The macros in this project are disabled. Please refer to the online help or documentation of the host application to determine how to enable macros. Thank you.
This comment was minimized by the moderator on the site
Hi,
Please follow the instructions in the screenshot below to check if macros are enabled in the macro settings in your Outlook. After enabling both options, re-run the VBA code.

https://www.extendoffice.com/images/stories/comments/comment-picture-zxm/macro-enabled.png
This comment was minimized by the moderator on the site
Thank you so much.
Rated 5 out of 5
This comment was minimized by the moderator on the site
Thank you for sharing VBA code. This work like magic and is going to save it lots of time!
This comment was minimized by the moderator on the site
Hello friends!

Thanks for sharing this VBA code.

Is there any way to change the location of the save folder?

I share the pc with some colleagues and in this case I need the files to be saved in a password protected folder which is not located in the documents folder.

How can I make this change?

Thank you in advance
This comment was minimized by the moderator on the site
Hi Fabiana,
Change the line 14
xFolderPath = xFolderPath & "\Attachments\"

to
xFolderPath = "C:\Users\Win10x64Test\Desktop\save attachments\1\"

Here "C:\Users\Win10x64Test\Desktop\save attachments\1\" is the folder path in my case.
Don't forget to end the folder path with a slash "\"
This comment was minimized by the moderator on the site
Hello friends!

Thank you for sharing that VBA code.

Is there any way to change the location of the save folder?

I share the pc with some colleagues and in this case I need the files to be saved in a password protected folder which is not located in the documents folder.

How can I make this change?

Thank you in advance
This comment was minimized by the moderator on the site
If you are trying to run the Code that renames duplicate files and keep getting a "User Type Not Defined" error message here is the code fixed. Instead of the "Dim xFso As FileSystemObject" on line 47 it should be "Dim xFso As Variant"
Also added a Message Box to appear at the end of data transfer.

Dim GCount As Integer
Dim GFilepath As String
Public Sub SaveAttachments()
'Update 20200821
Dim xMailItem As Outlook.MailItem
Dim xAttachments As Outlook.Attachments
Dim xSelection As Outlook.Selection
Dim i As Long
Dim xAttCount As Long
Dim xFilePath As String, xFolderPath As String, xSaveFiles As String
On Error Resume Next
xFolderPath = CreateObject("WScript.Shell").SpecialFolders(16)
Set xSelection = Outlook.Application.ActiveExplorer.Selection
xFolderPath = xFolderPath & "\Attachments\"
If VBA.Dir(xFolderPath, vbDirectory) = vbNullString Then
VBA.MkDir xFolderPath
End If
GFilepath = ""
For Each xMailItem In xSelection
Set xAttachments = xMailItem.Attachments
xAttCount = xAttachments.Count
xSaveFiles = ""
If xAttCount > 0 Then
For i = xAttCount To 1 Step -1
GCount = 0
xFilePath = xFolderPath & xAttachments.Item(i).FileName
GFilepath = xFilePath
xFilePath = FileRename(xFilePath)
If IsEmbeddedAttachment(xAttachments.Item(i)) = False Then
xAttachments.Item(i).SaveAsFile xFilePath
If xMailItem.BodyFormat <> olFormatHTML Then
xSaveFiles = xSaveFiles & vbCrLf & "<Error! Hyperlink reference not valid.>"
Else
xSaveFiles = xSaveFiles & "<br>" & "<a href='file://" & xFilePath & "'>" & xFilePath & "</a>"
End If
End If
Next i
End If
Next
Set xAttachments = Nothing
Set xMailItem = Nothing
Set xSelection = Nothing
MsgBoX prompt:="File Transfer Complete", Title:="Sweatyjalapenos tha Goat"
End Sub

Function FileRename(FilePath As String) As String
Dim xPath As String
Dim xFso As Variant
On Error Resume Next
Set xFso = CreateObject("Scripting.FileSystemObject")
xPath = FilePath
FileRename = xPath
If xFso.FileExists(xPath) Then
GCount = GCount + 1
xPath = xFso.GetParentFolderName(GFilepath) & "\" & xFso.GetBaseName(GFilepath) & " " & GCount & "." + xFso.GetExtensionName(GFilepath)
FileRename = FileRename(xPath)
End If
xFso = Nothing
End Function

Function IsEmbeddedAttachment(Attach As Attachment)
Dim xItem As MailItem
Dim xCid As String
Dim xID As String
Dim xHtml As String
On Error Resume Next
IsEmbeddedAttachment = False
Set xItem = Attach.Parent
If xItem.BodyFormat <> olFormatHTML Then Exit Function
xCid = ""
xCid = Attach.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001F")
If xCid <> "" Then
xHtml = xItem.HTMLBody
xID = "cid:" & xCid
If InStr(xHtml, xID) > 0 Then
IsEmbeddedAttachment = True

End If
End If
End Function
This comment was minimized by the moderator on the site
Very nice script as of 2022-10-19 works great, for me doesn't seem to change original message by adding text. The only thing I changed is I added message received date time to each file name with the following format so it would nicely sort by date time in Windows folder: "yyyy-mm-dd HH-mm-ss ".

Code:

Dim GCount As Integer
Dim GFilepath As String
Public Sub SaveAttachments()
'Update 20200821
Dim xMailItem As Outlook.MailItem
Dim xAttachments As Outlook.Attachments
Dim xSelection As Outlook.Selection
Dim i As Long
Dim xAttCount As Long
Dim xFilePath As String, xFolderPath As String, xSaveFiles As String, xDateFormat As String
On Error Resume Next
xFolderPath = CreateObject("WScript.Shell").SpecialFolders(16)
Set xSelection = Outlook.Application.ActiveExplorer.Selection
xFolderPath = xFolderPath & "\Attachments\"
If VBA.Dir(xFolderPath, vbDirectory) = vbNullString Then
VBA.MkDir xFolderPath
End If
GFilepath = ""
For Each xMailItem In xSelection
Set xAttachments = xMailItem.Attachments
xAttCount = xAttachments.Count
xSaveFiles = ""
If xAttCount > 0 Then
For i = xAttCount To 1 Step -1
GCount = 0
xDateFormat = Format(xMailItem.ReceivedTime, "yyyy-mm-dd HH-mm-ss ")
xFilePath = xFolderPath & xDateFormat & xAttachments.Item(i).FileName
GFilepath = xFilePath
xFilePath = FileRename(xFilePath)
If IsEmbeddedAttachment(xAttachments.Item(i)) = False Then
xAttachments.Item(i).SaveAsFile xFilePath
If xMailItem.BodyFormat <> olFormatHTML Then
xSaveFiles = xSaveFiles & vbCrLf & "<Error! Hyperlink reference not valid.>"
Else
xSaveFiles = xSaveFiles & "<br>" & "<a href='file://" & xFilePath & "'>" & xFilePath & "</a>"
End If
End If
Next i
End If
Next
Set xAttachments = Nothing
Set xMailItem = Nothing
Set xSelection = Nothing
End Sub

Function FileRename(FilePath As String) As String
Dim xPath As String
Dim xFso As FileSystemObject
On Error Resume Next
Set xFso = CreateObject("Scripting.FileSystemObject")
xPath = FilePath
FileRename = xPath
If xFso.FileExists(xPath) Then
GCount = GCount + 1
xPath = xFso.GetParentFolderName(GFilepath) & "\" & xFso.GetBaseName(GFilepath) & " " & GCount & "." + xFso.GetExtensionName(GFilepath)
FileRename = FileRename(xPath)
End If
xFso = Nothing
End Function

Function IsEmbeddedAttachment(Attach As Attachment)
Dim xItem As MailItem
Dim xCid As String
Dim xID As String
Dim xHtml As String
On Error Resume Next
IsEmbeddedAttachment = False
Set xItem = Attach.Parent
If xItem.BodyFormat <> olFormatHTML Then Exit Function
xCid = ""
xCid = Attach.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001F")
If xCid <> "" Then
xHtml = xItem.HTMLBody
xID = "cid:" & xCid
If InStr(xHtml, xID) > 0 Then
IsEmbeddedAttachment = True
End If
End If
End Function
This comment was minimized by the moderator on the site
Hi Oigo,
This is a very useful VBA script. Thank you for sharing it.
This comment was minimized by the moderator on the site
Hi crystal,

sorry for not being clear.

I was trying to use the code above mentioned. However, apparently I was doing something wrong. I was thinking that I might need to amend some parts in the code shown. For instance the path where to save the attachments and maybe some other parts. Therefore I was asking if you could share the code highlighting the parts which needs tailoring and how to tailor them.

Many thanks,
BR
This comment was minimized by the moderator on the site
Hi Rokkie,
Did you get any error prompt when the code runs? Or which line in your code is highlighted? I need more details so I can see where you can modify the code.
This comment was minimized by the moderator on the site
Hey crystal,

completeley new to this VBA. Can you share a code to use which shows where I have to amend with an example? As a Rookie it is a bit difficult to figure it out.

I am working via a Ctrix connection. Could this be a blocker for the macro?

Much appreaciate the help.
This comment was minimized by the moderator on the site
Hi Rookie,
Sorry I don't understand what you mean: "Can you share a code to use which shows where I have to amend with an example?"
And the code operates on selected emails in Outlook, Ctrix Connection does not block the macro.
This comment was minimized by the moderator on the site
Hi, I am running this Code 1 to extract .txt files from separate sub-folders of an inbox. It works great out of one sub-folder but not at all out of another sub-folder. I have tried forwarding the relevant email and attachment into other inboxes but no luck. The files are automatically generated and sent to the different sub-folders and only vary by a single letter in their title

Any help much is appreciated
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations