Macro to create a new folder with subject line as the folder name

Status
Not open for further replies.

StingOM

Member
Outlook version
Outlook 2010 64 bit
Email Account
POP3
Hi Folks,

I am new to this forum. I hoping that someone would be generous with their time to help me create a macro that will create a new folder in Outlook and extract the content of the subject line as the name of the new folder.

I work in an environment with hundreds of emails and it would be nice if I can filter out emails from clients looking for a new quote for a job.

The code I found on the web is a basic start. However, I don't know enough VB programming to modify the script for my needs:

Sub CreateFolder()

Dim F As Outlook.Mapifolder

Dim Name$

Set F = Application.Session.Pickfolder

If F Is Nothing Then Exit Sub

Name = Inputbox("Name?")

If Len(Name) = 0 Then Exit Sub

Name = "Quote - " & "-" & Name

F.Folders.Add Name

End Sub

My wish list:

1) An option (pop up menu) to allow me to confirm or modify the new folder name after the text extracted from the subject line

or

2) An option to append the subject line text content to a prefix of folder name as already shown in the code above.

and

3) An option to pre-define where the new folder should be created.

4) An option to move a selected message or a set of selected messages automatically into this new folder.

5) Open this new folder, after it is created and the messages have been moved into it.

Thanks.

Si
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
To do everything it's going to be complicated - you'll need to either learn vba or be good at searching and know enough vba to put the macros together.




2) you'll reference the selected message then use something like Name = "Quote - " & item.subject




You'll need to use something like


Dim Item As Object






' get function from Outlook VBA: work with open item or selected item - Slipstick Systems


' if you want it to work with open or selected messages


Set Item = GetCurrentItem()




Name = "Quote - " & item.subject




4) this can be done with a For... Next statement



For Each item In Selection




' do whatever




Next






5) you'd use something like this to open a folder
Set Application.ActiveExplorer.CurrentFolder = Name






I have macros at slipstick.com that you can learn from (and use bits in your own macro) and Michael has some here: VBOffice - Samples - he has several that work with folders that you can learn from.




I think on #1, you could use a msgbox or an input box. #3 should be a feature of the folder picker, otherwise i don't know.
 

StingOM

Member
Outlook version
Outlook 2010 64 bit
Email Account
POP3
Many thanks. I will try to pull something together. :D
 
Status
Not open for further replies.
Top