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

VBA script does not work



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old February 9th 09, 04:31 PM posted to microsoft.public.outlook.program_vba
Aaron
external usenet poster
 
Posts: 23
Default VBA script does not work

I am trying to write my first Outlook VBA code (I have written VBA in Excel
and Access so far) that triggers on a certain rule. In order to check to see
if the code is even firing, I have tried to create a simple message box that
shows the Sender string from a MailItem. However, know that the rule should
trigger, I still don't see any message box. I have check my security
settings, and they are set to allow all macro codes with a warning. Thank
you for any advice/help!

The rule and code are as follows:
Rule:
Apply this rule after the message arrives through xxx account run
Scripts.Test2

Code:
Option Explicit

Public Sub Test2(myMailItem As Outlook.MailItem)

Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim colFolders As Outlook.Folders
Dim objFolder As Outlook.Folder
Dim arrFolders() As String

Dim Sender As String
Dim Response As String

Set objApp = Application
Set objNS = objApp.GetNamespace("MAPI")
Set objFolder = objNS.Folders.item("ITCS (POP)\Inbox")

Sender = myMailItem.To
Response = MsgBox(Sender, vbYesNo, "Sender")

End Sub
 




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
Does the Shell method work in VB Script? Culverin Outlook and VBA 4 October 29th 11 06:58 AM
VBA script does not work Aaron Outlook and VBA 0 February 9th 09 04:31 PM
Outlk 2k3 Script: Saving Excel File programticaly from OUTLOOK SCRIPT news.microsoft.com Outlook and VBA 3 November 22nd 06 03:33 PM
Does the Shell method work in VB Script? Culverin Outlook - Using Forms 0 August 25th 06 02:22 PM
Outlook form with VB script wont work Hellstern Outlook - Using Forms 1 March 31st 06 02:21 PM


All times are GMT +1. The time now is 11:25 AM.


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.