![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hello all,
I have the following code, that is used in a rule when a message arrives. The rule should take a message with "newticket" on the subject and move it to helpdesk_unprocessed folder and run the script. The problem is that it runs sometimes and sometimes not. When it does not run, if I open the Visual Basic Editor and delete objItem As MailItem from the beggining, leaving the parethensis (), i can run the macro and always it works. I'm really confused, any help? thanks very much, Carlos Sub executeMacro(objItem As MailItem) Dim outApp As New Outlook.Application Dim nsp As Outlook.NameSpace Dim mpf As Outlook.MAPIFolder Dim mpfSubFolder As Outlook.MAPIFolder Dim flds As Outlook.Folders Dim msg As Object Dim msgSubject As String Dim summary As String Dim description As String Dim processed_folder As Outlook.MAPIFolder Set nsp = outApp.GetNamespace("MAPI") Set mpf = nsp.GetDefaultFolder(olFolderInbox) Set flds = mpf.Folders Set mpfSubFolder = flds.GetFirst Set processed_folder = flds("Helpdesk_Processed") Do While Not mpfSubFolder Is Nothing If mpfSubFolder.Name = "Helpdesk_Unprocessed" Then For Each msg In mpfSubFolder.Items If InStr(1, msg.Subject, "newticket") 0 Then MsgBox ("hola") msg.Move processed_folder End If Next End If Set mpfSubFolder = flds.GetNext Loop End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Rule 'run a script' not running my script | [email protected] | Outlook and VBA | 3 | May 30th 06 01:09 PM |
"Run a script" rule triggers but script does not execute | Trey Shaffer | Outlook and VBA | 7 | April 8th 06 12:34 AM |
Problem running a VBA script from an Outlook rule | Olivier Langlois | Outlook and VBA | 5 | March 16th 06 10:03 PM |
Problem running a VBA script from an Outlook rule | Olivier Langlois | Add-ins for Outlook | 5 | March 16th 06 10:03 PM |
Script in Rule | clarkel | Outlook and VBA | 2 | February 2nd 06 09:20 PM |