F
Freddy G
I'm becoming overwhelmed with junk mail at work and I
found a helpful article on handling junk mail at
http://office.microsoft.com/assistance/preview.aspx?
AssetID=HA010429701033&CTT=4&Origin=CH010715451033
which basically talks about creating a macro to add
multiple selected emails to the junk senders list and then
delete them all in one shot.
Here is a sample of the code that is giving me grief:
'********************************************************
Set objTextStream = objFSO.OpenTextFile _
(FileName:=JUNK_SENDERS_FILE, IOMode:=ForAppending)
Set objExplorer = Application.ActiveExplorer
For Each objMailItem In objExplorer.Selection
objTextStream.WriteLine Text:=objMailItem.SenderName
objMailItem.Delete
Next objMailItem
'********************************************************
The problem I've come across is that in it's use of
the 'SenderName' property it is adding the name of the
person sending the email, instead of the e-mail address
itself. If I right-click an email and select 'Add to Junk
Senders List' then it will add the address as I want it
too, but the code above will add the person's name and it
won't be filtered properly in doing so.
Is there another property I can use in place
of 'SenderName' to extraxt the email address, or is there
a setting in Outlook 2002 which will display the email
address in the From column of the Inbox instead of the
person's name? The macro is a great idea but it's one
step away from where I need it to be and I would hate to
scrap it when it's so close to being right.
Thanks in advance,
Freddy G.
found a helpful article on handling junk mail at
http://office.microsoft.com/assistance/preview.aspx?
AssetID=HA010429701033&CTT=4&Origin=CH010715451033
which basically talks about creating a macro to add
multiple selected emails to the junk senders list and then
delete them all in one shot.
Here is a sample of the code that is giving me grief:
'********************************************************
Set objTextStream = objFSO.OpenTextFile _
(FileName:=JUNK_SENDERS_FILE, IOMode:=ForAppending)
Set objExplorer = Application.ActiveExplorer
For Each objMailItem In objExplorer.Selection
objTextStream.WriteLine Text:=objMailItem.SenderName
objMailItem.Delete
Next objMailItem
'********************************************************
The problem I've come across is that in it's use of
the 'SenderName' property it is adding the name of the
person sending the email, instead of the e-mail address
itself. If I right-click an email and select 'Add to Junk
Senders List' then it will add the address as I want it
too, but the code above will add the person's name and it
won't be filtered properly in doing so.
Is there another property I can use in place
of 'SenderName' to extraxt the email address, or is there
a setting in Outlook 2002 which will display the email
address in the From column of the Inbox instead of the
person's name? The macro is a great idea but it's one
step away from where I need it to be and I would hate to
scrap it when it's so close to being right.
Thanks in advance,
Freddy G.