Outlook and spam....pls help

selkov

Well-known Member
Joined
Jan 26, 2004
Messages
787
I have a number of email accounts that I need to monitor via outlook.
I ahve about 5 each of 6 different sources...i.e. bellsouth dsl, comcast cable, aol...etc. All combined there is a ton of spam. I have not yet found a filter to work as well as just rporting them to the email service provider. Problem is that they all have different parameters...Forward as test...foward as attachment...place "this" in subject line....leave subject line blank etc.

I have a hot key that will move the mail to a specified folder based on the provide (Comcast spam - bellsouth spam etc). I am trying to write a script to set all the parameters for that provider.

Below I an example.
The email account is under the name of Motagu & it is a bellsouth account.
If I manually enter all the charecters via the keyboard it works perfectly.
But when I automate it it does not. In fact 1/2 the time when I open the script I get an errro (Sub or funtion not defined).

I am running w2k Pro & outllok 2000
Can anyone help me?

Thanks


Sub Motagu()

'Set to Forward as Attachment
SendKeys "%t"
SendKeys "o"
SendKeys "m"
SendKeys "%f"
SendKeys "a"
SendKeys "~"
SendKeys "%{f4}"

'Process Spam
For x = 1 To 25
'Set Header
SendKeys "~"
SendKeys "%w"
SendKeys "Thisisspam@bellsouth.net"

'Clear Subject line
SendKeys "%j"
For d = 1 To 50
SendKeys "{del}"
Next d

'Set Mail account & remove "Sent to " record
SendKeys "%p"
SendKeys "%u"
SendKeys "m"
SendKeys "%n"
SendKeys "~"

'Send mail
SendKeys "%S"
SendKeys "~"

'Delete original message
SendKeys "^d"
Next x

'Reset forward as text
SendKeys "%t"
SendKeys "o"
SendKeys "m"
SendKeys "%f"
SendKeys "i"
SendKeys "~"
SendKeys "%{f4}"


End Sub
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
I think I found the problem...but not the solution.
On setting a loop (forx=1to25) .
If there arte less than 25 msgs the program sends keys to the script & ovewrites the macro. No loop no problem!


But I have many emails in the folder. Is there any way I can get a COUNT on the number of files there so that I can set the loop to the proper variable?
 
Upvote 0

Forum statistics

Threads
1,225,354
Messages
6,184,458
Members
453,233
Latest member
bgmb

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