
September 24th, 2004, 12:39 PM
|
|
Registered User
|
|
Join Date: Sep 2004
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Outlook Macro for kicking off a Batch file
Hi everyone,
Im trying to create a Macro in outlook that will scan incoming emails for a specific subject. Once said email is received, it kicks off a batch job. The problem im having is with recognising the email when it comes in. Here is my code. Any suggestions? am i going about this totally wrong?
Public Sub Application_NewMail()
Dim currentnamespace As NameSpace
Dim v_shell_return As Integer
Dim currentmapifolder As MAPIFolder
Dim currentmailitem As MailItem
Set currentnamespace = Application.GetNamespace("MAPI")
Set currentmapifolder = currentnamespace.GetDefaultFolder(olFolderInbox)
Set currentmailitem = currentmapifolder.Items(currentmapifolder.Items.Co unt)
If currentmailitem.Subject Like "RICHARD" Then
v_shell_return = Shell("C:\test3.bat")
End If
End Sub
|