![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]() I wand to run though my full inbox and create a subfolder for each of the domain names therein, but leaving off the extension (.com, .org, .co.uk etc). For example, my inbox has 100 e-mails from a total of 25 different company domain names, e.r 10 from , 11 from , 5 from I therefore wand a folder called: Walker, Spaceage and Franksome Thanks again |
Ads |
#2
|
|||
|
|||
![]()
Thanks for that.
I need the vba to determine the folder names for me, based on the e-mail addresses it finds in my inbox, and then create the folders... ? I do not want to have to manually go through my e-mails myself and decide what folders are needed thanks again "Dmitry Streblechenko" wrote: set Inbox = Application.Session.(olFolderInbox) set NewSubFolder = Inbox.Folders.Add("Your new folder name") Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "S1lverface" wrote in message ... I wand to run though my full inbox and create a subfolder for each of the domain names therein, but leaving off the extension (.com, .org, .co.uk etc). For example, my inbox has 100 e-mails from a total of 25 different company domain names, e.r 10 from , 11 from , 5 from I therefore wand a folder called: Walker, Spaceage and Franksome Thanks again |
#3
|
|||
|
|||
![]()
set Inbox = Application.Session.(olFolderInbox)
set NewSubFolder = Inbox.Folders.Add("Your new folder name") Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "S1lverface" wrote in message ... I wand to run though my full inbox and create a subfolder for each of the domain names therein, but leaving off the extension (.com, .org, .co.uk etc). For example, my inbox has 100 e-mails from a total of 25 different company domain names, e.r 10 from , 11 from , 5 from I therefore wand a folder called: Walker, Spaceage and Franksome Thanks again |
#4
|
|||
|
|||
![]()
Thanks again...
I've spent the las hour trying to work it out, and failed. Below is the code I've used to manually create 5 folder names based on e-mail domain names from my inbox. I want it to go through the inbox and find these and others and create me the folders. I'm too new to VBA to understand the 'loop', 'parse' etc, but I do learn and follow examples well. I'm not sure where to put or what to put... If you could help that'd be great... Good news though is that I'm hoping to get an outlook vba programming book for my Xmas.... Its on my list! But in the meantime, all help is great..... S1lverface :-) '---------------------------------------------------------- Sub SetUpFolders() Dim oloUtlook As Outlook.Application Dim ns As Outlook.NameSpace Dim itm As Object On Error Resume Next Application.ScreenUpdating = False Set oloUtlook = CreateObject("Outlook.Application") Set ns = oloUtlook.GetNamespace("MAPI") Set itm = ns.GetDefaultFolder(olFolderInbox) itm.Folders.Add ("Fruitmarket") itm.Folders.Add ("Sales") itm.Folders.Add ("Blythe") itm.Folders.Add ("Yeoman") itm.Folders.Add ("Network") Set oloUtlook = Nothing Set ns = Nothing Set itm = Nothing MsgBox "All Done" ThisWorkbook.Close End Sub '----------------------------------------------------- "S1lverface" wrote: Thanks for that. I need the vba to determine the folder names for me, based on the e-mail addresses it finds in my inbox, and then create the folders... ? I do not want to have to manually go through my e-mails myself and decide what folders are needed thanks again "Dmitry Streblechenko" wrote: set Inbox = Application.Session.(olFolderInbox) set NewSubFolder = Inbox.Folders.Add("Your new folder name") Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "S1lverface" wrote in message ... I wand to run though my full inbox and create a subfolder for each of the domain names therein, but leaving off the extension (.com, .org, .co.uk etc). For example, my inbox has 100 e-mails from a total of 25 different company domain names, e.r 10 from , 11 from , 5 from I therefore wand a folder called: Walker, Spaceage and Franksome Thanks again |
#5
|
|||
|
|||
![]()
Loop through all messages in your inbox, read the SenderEmailAddres
property, parse it, add it to a list of folders to create if it is not already there. Then loop through the list and create subfolders. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "S1lverface" wrote in message ... Thanks for that. I need the vba to determine the folder names for me, based on the e-mail addresses it finds in my inbox, and then create the folders... ? I do not want to have to manually go through my e-mails myself and decide what folders are needed thanks again "Dmitry Streblechenko" wrote: set Inbox = Application.Session.(olFolderInbox) set NewSubFolder = Inbox.Folders.Add("Your new folder name") Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "S1lverface" wrote in message ... I wand to run though my full inbox and create a subfolder for each of the domain names therein, but leaving off the extension (.com, .org, .co.uk etc). For example, my inbox has 100 e-mails from a total of 25 different company domain names, e.r 10 from , 11 from , 5 from I therefore wand a folder called: Walker, Spaceage and Franksome Thanks again |
#6
|
|||
|
|||
![]()
Off the top of my head, don't know if it'll actually work:
On error resume next 'to be able to handle errors returened by Inbox.Folders() Set oloUtlook = CreateObject("Outlook.Application") Set ns = oloUtlook.GetNamespace("MAPI") Set Inbox = ns.GetDefaultFolder(olFolderInbox) for each Msg in Inbox.Items if Msg.Class = 43 Then address = Msg.SenderEmailAddress AddrParts = split(address, ".") if UBound(AddrParts) = 1 Then FolderName = AddrParts(UBound(AddrParts)-1) 'second last part err.Clear set Folder = Inbox.Folders(FolderName) if err.Number 0 Then 'the folder does not exist set Folder = Inbox.Folders.Add(FolderName) End If End If End If next Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "S1lverface" wrote in message ... Thanks again... I've spent the las hour trying to work it out, and failed. Below is the code I've used to manually create 5 folder names based on e-mail domain names from my inbox. I want it to go through the inbox and find these and others and create me the folders. I'm too new to VBA to understand the 'loop', 'parse' etc, but I do learn and follow examples well. I'm not sure where to put or what to put... If you could help that'd be great... Good news though is that I'm hoping to get an outlook vba programming book for my Xmas.... Its on my list! But in the meantime, all help is great..... S1lverface :-) '---------------------------------------------------------- Sub SetUpFolders() Dim oloUtlook As Outlook.Application Dim ns As Outlook.NameSpace Dim itm As Object On Error Resume Next Application.ScreenUpdating = False Set oloUtlook = CreateObject("Outlook.Application") Set ns = oloUtlook.GetNamespace("MAPI") Set itm = ns.GetDefaultFolder(olFolderInbox) itm.Folders.Add ("Fruitmarket") itm.Folders.Add ("Sales") itm.Folders.Add ("Blythe") itm.Folders.Add ("Yeoman") itm.Folders.Add ("Network") Set oloUtlook = Nothing Set ns = Nothing Set itm = Nothing MsgBox "All Done" ThisWorkbook.Close End Sub '----------------------------------------------------- "S1lverface" wrote: Thanks for that. I need the vba to determine the folder names for me, based on the e-mail addresses it finds in my inbox, and then create the folders... ? I do not want to have to manually go through my e-mails myself and decide what folders are needed thanks again "Dmitry Streblechenko" wrote: set Inbox = Application.Session.(olFolderInbox) set NewSubFolder = Inbox.Folders.Add("Your new folder name") Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "S1lverface" wrote in message ... I wand to run though my full inbox and create a subfolder for each of the domain names therein, but leaving off the extension (.com, .org, .co.uk etc). For example, my inbox has 100 e-mails from a total of 25 different company domain names, e.r 10 from , 11 from , 5 from I therefore wand a folder called: Walker, Spaceage and Franksome Thanks again |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Create folder based on senders name in the Inbox | S1lverface | Outlook and VBA | 4 | December 6th 07 07:01 AM |
Move and create folder based on subject | Peter R. | Outlook and VBA | 3 | December 5th 07 06:46 AM |
distro list - create based on company name | Jeremy Schubert | Outlook - Using Contacts | 1 | October 28th 07 08:58 PM |
How to create a rule to move emails based on a particular domain | Net | Outlook - General Queries | 3 | November 22nd 06 02:35 PM |
create a rule for *@domain.dns | Gordon | Outlook - General Queries | 4 | May 11th 06 09:28 AM |