Read mail's Subject

Maurizio

Well-known Member
Joined
Oct 15, 2002
Messages
691
Office Version
  1. 2007
Platform
  1. Windows
Hi all,
is it possible read, with vba, all "Subject" from my received mails (Outlook Express 6.0) on 05/05/2003 and report them on a sheets?

Tia.
 
I agree!, up until now I have copied my inbox, pasted into excel then parsed the data out with text to columns then deleted what I didn't need. This would be very helpful!!

Thanks Mr. Excel!
 
Upvote 0

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
txksa said:
can anyone help out with routing to a personal outlook folder on my H: or routing to a public folder located in outlook?

I think:

Set MySubFolder = NmSpace.Folders.Item("YourFolderName")

should work for you (change YourFolderName to the actual folder name).
 
Upvote 0
I can obtain information from subfolders as long as they are in my inbox, but I need to get information that is not stored in my inbox. These are in Public folder and one is a personal folder routed through my h:
 
Upvote 0
I'm not clear with what you want to get.

This
<font face=Courier New>
<SPAN style="color:#00007F">Sub</SPAN> ReadFromOutlook()
    <SPAN style="color:#00007F">Dim</SPAN> OutApp <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Object</SPAN>    <SPAN style="color:#007F00">'Outlook.Application</SPAN>
    <SPAN style="color:#00007F">Dim</SPAN> NmSpace <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Object</SPAN>   <SPAN style="color:#007F00">'Outlook.NameSpace</SPAN>
    <SPAN style="color:#00007F">Dim</SPAN> Folder <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Object</SPAN>    <SPAN style="color:#007F00">'Outlook.MAPIFolder</SPAN>
    <SPAN style="color:#00007F">Dim</SPAN> MItem <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Object</SPAN>     <SPAN style="color:#007F00">'Outlook.MailItem</SPAN>
    
    <SPAN style="color:#00007F">Set</SPAN> OutApp = CreateObject("Outlook.Application")
    <SPAN style="color:#00007F">Set</SPAN> NmSpace = OutApp.GetNamespace("MAPI")
    <SPAN style="color:#00007F">For</SPAN> <SPAN style="color:#00007F">Each</SPAN> Folder <SPAN style="color:#00007F">In</SPAN> NmSpace.Folders
        MsgBox Folder.Name
    <SPAN style="color:#00007F">Next</SPAN> Folder
    <SPAN style="color:#00007F">Set</SPAN> Folder = <SPAN style="color:#00007F">Nothing</SPAN>
    <SPAN style="color:#00007F">Set</SPAN> NmSpace = <SPAN style="color:#00007F">Nothing</SPAN>
    <SPAN style="color:#00007F">Set</SPAN> OutApp = <SPAN style="color:#00007F">Nothing</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>


</FONT>
will show you the name of all folders that you have in Outlook (The "main" folders sort of speak). In my case, I have three, the 'Mail PC' where everything is stored, 'JP Mail' which is my personal pst folder, and 'Archive Folders' which is for that, archive.

I don't understand where is this folder / subfolder that you want to get, but for example this:

<font face=Courier New>    <SPAN style="color:#00007F">Set</SPAN> Folder = NmSpace.GetDefaultFolder(6).Parent.Folders("MrExcel")</FONT>

will get to the MrExcel folder, that is stored in the same 'file' as the Inbox (That's why I use the .GetDefaultFolder, so I don't have to specify a file hardcoded)

Does this help ?
 
Upvote 0
I am sorry for sounding absolutely ignorant about all of this. does the getdefaultfolder only get that which is in the inbox?
if i want to get something from my personal .pst folder, how would i write that out?
can you give me an example of how you would write it using your 3 folders?
 
Upvote 0
The problem is that I have NO idea what you want...

Run the macro I gave. It should give you a message box with the name of your n pst files. Now, where is the folder that you want to get ? is it in a 'stand alone' pst ? or is it in the same pst file where your Inbox is ?
 
Upvote 0
i ran you macro and it did show me my 3 'main' boxes. (public folders, mailbox, ak2101)
From mailbox(main inbox) i only need to go down 1 level to "Bellsouth"
From ak2101 i need to go down to "Bellsouth" and then "Mgr"
From public folders I need to go down to "all public folders" to "Job" to "State" to "nac dsc swap" to "Emp Changes"

I need to grab the From Field, Subject Field and Received field.
 
Upvote 0
To access a Folder within a Folder, you need something like this:

Set MySubFolder = NmSpace.Folders("ak2101").Folders("BellSouth").Folders("Mgr")

if that's your tree structure.
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top