A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Create a macro that runs from a Rule



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old January 10th 06, 08:50 PM posted to microsoft.public.outlook.program_vba
CF_business_analyst
external usenet poster
 
Posts: 1
Default Create a macro that runs from a Rule

I have created a vba script that needs to be run on regular intervals... It
processes the messages for our SOX audit procedures. I think I need to
create it as a class module, and some other things, but did not understand
the directions... I am not normally a vba programmer


Ads
  #2  
Old January 10th 06, 09:21 PM posted to microsoft.public.outlook.program_vba
Michael Bauer
external usenet poster
 
Posts: 435
Default Create a macro that runs from a Rule

Am Tue, 10 Jan 2006 12:50:02 -0800 schrieb CF_business_analyst:

In what intervals do you need it to run?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook



I have created a vba script that needs to be run on regular intervals...

It
processes the messages for our SOX audit procedures. I think I need to
create it as a class module, and some other things, but did not understand
the directions... I am not normally a vba programmer

  #3  
Old January 10th 06, 10:06 PM posted to microsoft.public.outlook.program_vba
CF_business_analyst
external usenet poster
 
Posts: 4
Default Create a macro that runs from a Rule

A couple of times a day, or at least once a day. I should also state that
this is for an alternate profile which is used for only the SOX audit
messages. Theoretically, the profile / outlook would run on a server and
process the messages as they come thru. We're talking only up to 20 messages
per day (guesstimate)

"Michael Bauer" wrote:

Am Tue, 10 Jan 2006 12:50:02 -0800 schrieb CF_business_analyst:

In what intervals do you need it to run?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook



I have created a vba script that needs to be run on regular intervals...

It
processes the messages for our SOX audit procedures. I think I need to
create it as a class module, and some other things, but did not understand
the directions... I am not normally a vba programmer


  #4  
Old January 11th 06, 06:53 AM posted to microsoft.public.outlook.program_vba
Michael Bauer
external usenet poster
 
Posts: 435
Default Create a macro that runs from a Rule

Am Tue, 10 Jan 2006 14:06:02 -0800 schrieb CF_business_analyst:

Do you stick with VBA and Outlook or are we now talking about an Exchange
Server (wich is out of my head)?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook



A couple of times a day, or at least once a day. I should also state that
this is for an alternate profile which is used for only the SOX audit
messages. Theoretically, the profile / outlook would run on a server and
process the messages as they come thru. We're talking only up to 20

messages
per day (guesstimate)

"Michael Bauer" wrote:

Am Tue, 10 Jan 2006 12:50:02 -0800 schrieb CF_business_analyst:

In what intervals do you need it to run?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook



I have created a vba script that needs to be run on regular intervals...

It
processes the messages for our SOX audit procedures. I think I need to
create it as a class module, and some other things, but did not

understand
the directions... I am not normally a vba programmer


  #5  
Old January 11th 06, 02:24 PM posted to microsoft.public.outlook.program_vba
CF_business_analyst
external usenet poster
 
Posts: 4
Default Create a macro that runs from a Rule

Yes, I stuck with VBA. Do you know how to make a VBA procedure into a macro
or a "script" settable as run from a Rule?

"CF_business_analyst" wrote:

A couple of times a day, or at least once a day. I should also state that
this is for an alternate profile which is used for only the SOX audit
messages. Theoretically, the profile / outlook would run on a server and
process the messages as they come thru. We're talking only up to 20 messages
per day (guesstimate)

"Michael Bauer" wrote:

Am Tue, 10 Jan 2006 12:50:02 -0800 schrieb CF_business_analyst:

In what intervals do you need it to run?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook



I have created a vba script that needs to be run on regular intervals...

It
processes the messages for our SOX audit procedures. I think I need to
create it as a class module, and some other things, but did not understand
the directions... I am not normally a vba programmer


  #6  
Old January 12th 06, 06:02 AM posted to microsoft.public.outlook.program_vba
Michael Bauer
external usenet poster
 
Posts: 435
Default Create a macro that runs from a Rule

Am Wed, 11 Jan 2006 06:24:02 -0800 schrieb CF_business_analyst:

Write the method into ThisOutlookSession like this:

Public Method(oMail as Outlook.MailItem)
....
End Sub

That can be called from a rule.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook



Yes, I stuck with VBA. Do you know how to make a VBA procedure into a

macro
or a "script" settable as run from a Rule?

"CF_business_analyst" wrote:

A couple of times a day, or at least once a day. I should also state

that
this is for an alternate profile which is used for only the SOX audit
messages. Theoretically, the profile / outlook would run on a server and
process the messages as they come thru. We're talking only up to 20

messages
per day (guesstimate)

"Michael Bauer" wrote:

Am Tue, 10 Jan 2006 12:50:02 -0800 schrieb CF_business_analyst:

In what intervals do you need it to run?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook



I have created a vba script that needs to be run on regular

intervals...
It
processes the messages for our SOX audit procedures. I think I need

to
create it as a class module, and some other things, but did not

understand
the directions... I am not normally a vba programmer

  #7  
Old January 12th 06, 05:12 PM posted to microsoft.public.outlook.program_vba
CF_business_analyst
external usenet poster
 
Posts: 4
Default Create a macro that runs from a Rule

OK, I'm a VBA dunce. Not familiar with method concept. Here is the code, if
you could tell me what to do, i'd appreciate it.

Public Sub Check_Validation()

Dim oApp As Application 'set up the variables
Dim oNS As NameSpace
Dim oMessage As Object
Dim oAttachments As Outlook.Attachments
Dim oSave_outbox As Outlook.MAPIFolder
Dim my_savebox As Outlook.MAPIFolder
Dim NbrMsgs, f, fs
Dim val_string
Const OLTXT = 0
' Create new Outlook Application
Set oApp = New Outlook.Application
Set oNS = oApp.GetNamespace("MAPI")
Set oFolder = oNS.GetDefaultFolder(olFolderInbox)
Set fs = CreateObject("Scripting.FileSystemObject")

cc_dir = "\\directory-path"
Other_dir = "\directory-path\"
REL_DIR = "\\directory-path\"
'will need some code to ensure file and directory Structure are not too long
val_string = "VALID"
compare_string = " "
NbrMsgs = 0
'Cycle through the messages

For Each oMessage In oFolder.Items

With oMessage
Set myItem = oMessage
strname = myItem.Subject
'Need to check both upper and lower case, so transform subject to
upper case for comparison
compare_string = UCase(oMessage.Subject)

str_len = Len(compare_string)

'Process message if the subject includes the word validation
If InStrRev(compare_string, val_string) 0 Then

If InStrRev(compare_string, "CC") 0 Then
FileName = cc_dir & strname
ElseIf InStrRev(compare_string, "REL") 0 Then
FileName = REL_DIR & strname
Else: FileName = Other_dir & strname
End If
dir_len = Len(FileName) - str_len

Set file = fs.CreateTextFile(FileName, True)

NbrMsgs = NbrMsgs + 1

file.WriteLine ("Validation File sent using Subjectline: " &
strname)
file.Close

End If
.Delete
End With
Next
End Sub




"Michael Bauer" wrote:

Am Wed, 11 Jan 2006 06:24:02 -0800 schrieb CF_business_analyst:

Write the method into ThisOutlookSession like this:

Public Method(oMail as Outlook.MailItem)
....
End Sub

That can be called from a rule.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook



Yes, I stuck with VBA. Do you know how to make a VBA procedure into a

macro
or a "script" settable as run from a Rule?

"CF_business_analyst" wrote:

A couple of times a day, or at least once a day. I should also state

that
this is for an alternate profile which is used for only the SOX audit
messages. Theoretically, the profile / outlook would run on a server and
process the messages as they come thru. We're talking only up to 20

messages
per day (guesstimate)

"Michael Bauer" wrote:

Am Tue, 10 Jan 2006 12:50:02 -0800 schrieb CF_business_analyst:

In what intervals do you need it to run?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook



I have created a vba script that needs to be run on regular

intervals...
It
processes the messages for our SOX audit procedures. I think I need

to
create it as a class module, and some other things, but did not

understand
the directions... I am not normally a vba programmer


  #8  
Old January 13th 06, 07:08 AM posted to microsoft.public.outlook.program_vba
Michael Bauer
external usenet poster
 
Posts: 435
Default Create a macro that runs from a Rule

Am Thu, 12 Jan 2006 09:12:02 -0800 schrieb CF_business_analyst:

The run-a-script rule can be used to handle one item detected by the rule.

Regarding your function you can write this into ThisOutlookSession:

Public Sub Check_Validation(oMessage as Outlook.MailItem)
... all the stuff here
...
Delete the "For Each" line ...
...
... and delete line starting with "Next"
End Sub

If you can“t create a rule with all the needed criteria then simply create
one that fires for every incoming message and run the script.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook



OK, I'm a VBA dunce. Not familiar with method concept. Here is the code,

if
you could tell me what to do, i'd appreciate it.

Public Sub Check_Validation()

Dim oApp As Application 'set up the variables
Dim oNS As NameSpace
Dim oMessage As Object
Dim oAttachments As Outlook.Attachments
Dim oSave_outbox As Outlook.MAPIFolder
Dim my_savebox As Outlook.MAPIFolder
Dim NbrMsgs, f, fs
Dim val_string
Const OLTXT = 0
' Create new Outlook Application
Set oApp = New Outlook.Application
Set oNS = oApp.GetNamespace("MAPI")
Set oFolder = oNS.GetDefaultFolder(olFolderInbox)
Set fs = CreateObject("Scripting.FileSystemObject")

cc_dir = "\\directory-path"
Other_dir = "\directory-path\"
REL_DIR = "\\directory-path\"
'will need some code to ensure file and directory Structure are not too

long
val_string = "VALID"
compare_string = " "
NbrMsgs = 0
'Cycle through the messages

For Each oMessage In oFolder.Items

With oMessage
Set myItem = oMessage
strname = myItem.Subject
'Need to check both upper and lower case, so transform subject to
upper case for comparison
compare_string = UCase(oMessage.Subject)

str_len = Len(compare_string)

'Process message if the subject includes the word validation
If InStrRev(compare_string, val_string) 0 Then

If InStrRev(compare_string, "CC") 0 Then
FileName = cc_dir & strname
ElseIf InStrRev(compare_string, "REL") 0 Then
FileName = REL_DIR & strname
Else: FileName = Other_dir & strname
End If
dir_len = Len(FileName) - str_len

Set file = fs.CreateTextFile(FileName, True)

NbrMsgs = NbrMsgs + 1

file.WriteLine ("Validation File sent using Subjectline: " &
strname)
file.Close

End If
.Delete
End With
Next
End Sub




"Michael Bauer" wrote:

Am Wed, 11 Jan 2006 06:24:02 -0800 schrieb CF_business_analyst:

Write the method into ThisOutlookSession like this:

Public Method(oMail as Outlook.MailItem)
....
End Sub

That can be called from a rule.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook



Yes, I stuck with VBA. Do you know how to make a VBA procedure into a

macro
or a "script" settable as run from a Rule?

"CF_business_analyst" wrote:

A couple of times a day, or at least once a day. I should also state

that
this is for an alternate profile which is used for only the SOX audit
messages. Theoretically, the profile / outlook would run on a server

and
process the messages as they come thru. We're talking only up to 20

messages
per day (guesstimate)

"Michael Bauer" wrote:

Am Tue, 10 Jan 2006 12:50:02 -0800 schrieb CF_business_analyst:

In what intervals do you need it to run?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook



I have created a vba script that needs to be run on regular

intervals...
It
processes the messages for our SOX audit procedures. I think I need

to
create it as a class module, and some other things, but did not

understand
the directions... I am not normally a vba programmer


  #9  
Old January 13th 06, 05:12 PM posted to microsoft.public.outlook.program_vba
CF_business_analyst
external usenet poster
 
Posts: 4
Default Create a macro that runs from a Rule

THANK YOU. I did not understand how use the parameter. This works completely.

"Michael Bauer" wrote:

Am Thu, 12 Jan 2006 09:12:02 -0800 schrieb CF_business_analyst:

The run-a-script rule can be used to handle one item detected by the rule.

Regarding your function you can write this into ThisOutlookSession:

Public Sub Check_Validation(oMessage as Outlook.MailItem)
... all the stuff here
...
Delete the "For Each" line ...
...
... and delete line starting with "Next"
End Sub

If you can“t create a rule with all the needed criteria then simply create
one that fires for every incoming message and run the script.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook



OK, I'm a VBA dunce. Not familiar with method concept. Here is the code,

if
you could tell me what to do, i'd appreciate it.

Public Sub Check_Validation()

Dim oApp As Application 'set up the variables
Dim oNS As NameSpace
Dim oMessage As Object
Dim oAttachments As Outlook.Attachments
Dim oSave_outbox As Outlook.MAPIFolder
Dim my_savebox As Outlook.MAPIFolder
Dim NbrMsgs, f, fs
Dim val_string
Const OLTXT = 0
' Create new Outlook Application
Set oApp = New Outlook.Application
Set oNS = oApp.GetNamespace("MAPI")
Set oFolder = oNS.GetDefaultFolder(olFolderInbox)
Set fs = CreateObject("Scripting.FileSystemObject")

cc_dir = "\\directory-path"
Other_dir = "\directory-path\"
REL_DIR = "\\directory-path\"
'will need some code to ensure file and directory Structure are not too

long
val_string = "VALID"
compare_string = " "
NbrMsgs = 0
'Cycle through the messages

For Each oMessage In oFolder.Items

With oMessage
Set myItem = oMessage
strname = myItem.Subject
'Need to check both upper and lower case, so transform subject to
upper case for comparison
compare_string = UCase(oMessage.Subject)

str_len = Len(compare_string)

'Process message if the subject includes the word validation
If InStrRev(compare_string, val_string) 0 Then

If InStrRev(compare_string, "CC") 0 Then
FileName = cc_dir & strname
ElseIf InStrRev(compare_string, "REL") 0 Then
FileName = REL_DIR & strname
Else: FileName = Other_dir & strname
End If
dir_len = Len(FileName) - str_len

Set file = fs.CreateTextFile(FileName, True)

NbrMsgs = NbrMsgs + 1

file.WriteLine ("Validation File sent using Subjectline: " &
strname)
file.Close

End If
.Delete
End With
Next
End Sub




"Michael Bauer" wrote:

Am Wed, 11 Jan 2006 06:24:02 -0800 schrieb CF_business_analyst:

Write the method into ThisOutlookSession like this:

Public Method(oMail as Outlook.MailItem)
....
End Sub

That can be called from a rule.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook



Yes, I stuck with VBA. Do you know how to make a VBA procedure into a
macro
or a "script" settable as run from a Rule?

"CF_business_analyst" wrote:

A couple of times a day, or at least once a day. I should also state
that
this is for an alternate profile which is used for only the SOX audit
messages. Theoretically, the profile / outlook would run on a server

and
process the messages as they come thru. We're talking only up to 20
messages
per day (guesstimate)

"Michael Bauer" wrote:

Am Tue, 10 Jan 2006 12:50:02 -0800 schrieb CF_business_analyst:

In what intervals do you need it to run?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook



I have created a vba script that needs to be run on regular
intervals...
It
processes the messages for our SOX audit procedures. I think I need
to
create it as a class module, and some other things, but did not
understand
the directions... I am not normally a vba programmer



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Junk E-mail folder - is there a way to create a rule to delete items in this folder older than X days? Jaycee Outlook - General Queries 1 February 22nd 06 04:54 PM
Create a re-running rule JDR Outlook - General Queries 2 February 15th 06 09:17 PM
How can I create a rule in Outlook 03 to Bcc to a Distribution lis BC Outlook - Installation 1 January 31st 06 05:02 PM
Code runs in design mode karlman Outlook - Using Forms 2 January 27th 06 05:49 PM
How do I create a rule to bcc myself everytime I email a contact. Daffodilly Outlook - Using Contacts 2 January 18th 06 03:42 PM


All times are GMT +1. The time now is 07:55 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.