Save attachment In sub folder
-
- 2StarLounger
- Posts: 170
- Joined: 26 Jan 2017, 07:24
Save attachment In sub folder
Hello All
I want to save outlook attachments auto create subfolder with the name of mail subject in main folder.
Code should like by selecting mails either single or multiple.
I made lots google searches butt didn't find any solution
Any possibility or suggestion
Nabeel
I want to save outlook attachments auto create subfolder with the name of mail subject in main folder.
Code should like by selecting mails either single or multiple.
I made lots google searches butt didn't find any solution
Any possibility or suggestion
Nabeel
-
- Administrator
- Posts: 78788
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Save attachment In sub folder
See 32/64-bit compatible version of Outlook Attachment Manager for a zip file with code that removes attachments from email messages and saves them in a folder. The code could be modified to save the attachments to a folder named after the subject of the message.
Best wishes,
Hans
Hans
-
- 2StarLounger
- Posts: 170
- Joined: 26 Jan 2017, 07:24
Re: Save attachment In sub folder
i unzipped the file & follow the instruction as mention, some of issues
code is showing red highlighted some area, i think below code is repeating & i deleted repeated part but still in red below is three red highlighted (different location)in code
& sir, i am not a proficient to change in VBA (how & where)
![HairOut :hairout:](./images/smilies/hairout.gif)
code is showing red highlighted some area, i think below code is repeating & i deleted repeated part but still in red below is three red highlighted (different location)in code
& sir, i am not a proficient to change in VBA (how & where)
![HairOut :hairout:](./images/smilies/hairout.gif)
![HairOut :hairout:](./images/smilies/hairout.gif)
You do not have the required permissions to view the files attached to this post.
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: Save attachment In sub folder
Instead of 'importing' the individual bas and frm modules, just drag them into the VbaProject.OTM directly from Windows Explorer.
Open Outlook and access the VBA window (ALT + F11)
Then open Windows Explorer and drag the files onto the VbaProject.OTM (see image below)
The 3 forms and the 2 modules will be added to the project.
You do not need to edit any code as it will import without issues.
You can use the macro by running the frmAttachmentManager.frm or follow the rest of the instructions to add a button to the Quick Access Toolbar.
This is what the VBA Project will look like after ta correct import.
Open Outlook and access the VBA window (ALT + F11)
Then open Windows Explorer and drag the files onto the VbaProject.OTM (see image below)
The 3 forms and the 2 modules will be added to the project.
You do not need to edit any code as it will import without issues.
You can use the macro by running the frmAttachmentManager.frm or follow the rest of the instructions to add a button to the Quick Access Toolbar.
This is what the VBA Project will look like after ta correct import.
You do not have the required permissions to view the files attached to this post.
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- 2StarLounger
- Posts: 170
- Joined: 26 Jan 2017, 07:24
Re: Save attachment In sub folder
thanks for help now this is as like as you say
some of part still in RED but code is working fine i run, need amendment that attachment save in sub folder which auto create with the name of mail subject with multi selection of mail, Right now this is only saving one mail attachment if select 4 to 5 mails(multi selection means all selected mails create its own sub folder not all selected in one) & i just need attachment which is sender attached, not body mail attachment like logo, icon of twitter FB address ect..
please help
Nabeel
some of part still in RED but code is working fine i run, need amendment that attachment save in sub folder which auto create with the name of mail subject with multi selection of mail, Right now this is only saving one mail attachment if select 4 to 5 mails(multi selection means all selected mails create its own sub folder not all selected in one) & i just need attachment which is sender attached, not body mail attachment like logo, icon of twitter FB address ect..
please help
Nabeel
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78788
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Save attachment In sub folder
I don't think Outlook distinguishes between different types of attachments. In other words, we don't know if an attachment is a logo or icon, or a file attached explicitly by the sender.
Best wishes,
Hans
Hans
-
- 2StarLounger
- Posts: 170
- Joined: 26 Jan 2017, 07:24
Re: Save attachment In sub folder
hmm,i mean logo or ican in body mail under signature ect like below, there is an option in your code to unselect i can go with it, can you modify code for subfolder and with multi selection as stated in last my post, please
Nabeel
Rgd'sNabeel
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78788
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- 2StarLounger
- Posts: 170
- Joined: 26 Jan 2017, 07:24
Re: Save attachment In sub folder
thanks sir for this, i really appreciate your any help regarding this..!
Rgd's
Nabeel
Rgd's
Nabeel
-
- Administrator
- Posts: 78788
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Save attachment In sub folder
Here is a zip file with a new version. It creates subfolders in the user's Documents folder, but you can change that if you like by editing the line
Remove the previous modules and userforms, then drag the module and the two userforms into the Project Explorer in the Visual Basic Editor.
StartAttachmentManager is still the macro to call.
Code: Select all
strMainFolder = CreateObject("Wscript.Shell").SpecialFolders("MyDocuments") & "\"
StartAttachmentManager is still the macro to call.
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans
Hans
-
- 2StarLounger
- Posts: 170
- Joined: 26 Jan 2017, 07:24
Re: Save attachment In sub folder
this is superb sir, outclass stuff, you are master class
i want to change the path where i place this line, please guide i want to make path C:\Users\nabeel.akhtar1\Desktop\NP\
Nabeel
![Clapping :clapping:](./images/smilies/clapping.gif)
![Clapping :clapping:](./images/smilies/clapping.gif)
![Clapping :clapping:](./images/smilies/clapping.gif)
i want to change the path where i place this line, please guide i want to make path C:\Users\nabeel.akhtar1\Desktop\NP\
Nabeel
-
- Administrator
- Posts: 78788
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Save attachment In sub folder
Simply change the line
to
Code: Select all
strMainFolder = CreateObject("Wscript.Shell").SpecialFolders("MyDocuments") & "\"
Code: Select all
strMainFolder = "C:\Users\nabeel.akhtar1\Desktop\NP\"
Best wishes,
Hans
Hans
-
- 2StarLounger
- Posts: 170
- Joined: 26 Jan 2017, 07:24
Re: Save attachment In sub folder
i didn't find this mention line in code at basattmat module.
Nabeel
Code: Select all
strMainFolder = CreateObject("Wscript.Shell").SpecialFolders("MyDocuments") & "\"
-
- Administrator
- Posts: 78788
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Save attachment In sub folder
The line is in the code of the userform frmAttachmentManager.
Best wishes,
Hans
Hans
-
- 2StarLounger
- Posts: 170
- Joined: 26 Jan 2017, 07:24
Re: Save attachment In sub folder
hurray hurray hurray sweet hug sir
thnx a lot sir, you make my work soo easy in fact now it will be in minutes
May God bless you with health
Nabeel
![Grin :grin:](./images/smilies/grin.gif)
![Grin :grin:](./images/smilies/grin.gif)
thnx a lot sir, you make my work soo easy in fact now it will be in minutes
![ThankYou :thankyou:](./images/smilies/thankyou.gif)
![ThankYou :thankyou:](./images/smilies/thankyou.gif)
![ThankYou :thankyou:](./images/smilies/thankyou.gif)
![ThankYou :thankyou:](./images/smilies/thankyou.gif)
May God bless you with health
Nabeel
-
- 2StarLounger
- Posts: 170
- Joined: 26 Jan 2017, 07:24
Re: Save attachment In sub folder
Hi sir
i am here again with some issue, i selected almost 55 mails and run code, code shows me below error & when i click on debug that bring me here if this is due to duplication of subject (which is my thought) code should kept all duplicates..!
Nabeel
i am here again with some issue, i selected almost 55 mails and run code, code shows me below error & when i click on debug that bring me here if this is due to duplication of subject (which is my thought) code should kept all duplicates..!
Nabeel
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78788
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Save attachment In sub folder
I hadn't taken into account that the subject would end in a long number. See if this works better:
Code: Select all
Public Function funcSuggestName(strT As String) As String
Dim intL As Integer
Dim intC As Integer
Dim intP As Integer
Dim intN As Integer
Dim strQ As String
Dim strX As String
Dim strN As String
Dim str_ As String
Dim boolNum As Boolean
funcSuggestName = strT
Do
intP = InStrRev(funcSuggestName, ".")
If intP = 0 Then
strQ = funcSuggestName
Else
strQ = Left(funcSuggestName, intP - 1)
strX = Mid(funcSuggestName, intP)
End If
intL = Len(strQ) ' string length without the extension
For intC = intL To 1 Step -1
intN = Asc(Mid(strQ, intC, 1))
If intN < 48 Or intN > 57 Then
Exit For
End If
Next intC
If intC = intL Then
strQ = strQ & "_1"
ElseIf intL - intC < 9 Then
strQ = Left(strQ, intC) & (CLng(Mid(strQ, intC + 1)) + 1)
Else
strQ = strQ & "_" & Int(100 * Timer)
End If
funcSuggestName = strQ & strX
DoEvents
Loop Until NoDupFileExists(funcSuggestName)
End Function
Best wishes,
Hans
Hans
-
- 2StarLounger
- Posts: 170
- Joined: 26 Jan 2017, 07:24
Re: Save attachment In sub folder
now its shows me duplicate file window, here asking for file name change one by one for all, than saving all the files in that one folder, isn't required this to me.
just want, it should allow folder name change once for each folder(irrespective of how many attachments are under it & do not ask for file name change under folder)than save attachment in it or auto rename folder like under
if subject is
SOHO-7102-03018240182
than
SOHO-7102-03018240182-001
SOHO-7102-03018240182-002
SOHO-7102-03018240182-003
Rgd's
Nabeel
just want, it should allow folder name change once for each folder(irrespective of how many attachments are under it & do not ask for file name change under folder)than save attachment in it or auto rename folder like under
if subject is
SOHO-7102-03018240182
than
SOHO-7102-03018240182-001
SOHO-7102-03018240182-002
SOHO-7102-03018240182-003
Rgd's
Nabeel
-
- Administrator
- Posts: 78788
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Save attachment In sub folder
Do you want to save attachments from different messages with the same subject in different folders?
Best wishes,
Hans
Hans
-
- 2StarLounger
- Posts: 170
- Joined: 26 Jan 2017, 07:24
Re: Save attachment In sub folder
for only which has same subject mails other than code is okay.!
code is working fine i observed that only error occur when their is two or three mails are with same subject.
for example
if i received 6 mails with below same subject
SOHO-7102-03018240182
than 6 sub folders will create & each folder will contain their attachment
SOHO-7102-03018240182-001
SOHO-7102-03018240182-002
SOHO-7102-03018240182-003
SOHO-7102-03018240182-004
SOHO-7102-03018240182-005
SOHO-7102-03018240182-006
Rgd's
Nabeel
code is working fine i observed that only error occur when their is two or three mails are with same subject.
for example
if i received 6 mails with below same subject
SOHO-7102-03018240182
than 6 sub folders will create & each folder will contain their attachment
SOHO-7102-03018240182-001
SOHO-7102-03018240182-002
SOHO-7102-03018240182-003
SOHO-7102-03018240182-004
SOHO-7102-03018240182-005
SOHO-7102-03018240182-006
Rgd's
Nabeel