View Single Post
  #6  
Old July 7th 09, 09:20 PM posted to microsoft.public.outlook.program_vba
laavista
external usenet poster
 
Posts: 15
Default STILL IS NOT AVAILABLE... Run A Script not listed in rules wiz

Alan, you do not know how much I appreciate you looking at my code to see if
the security warnings can be eliminated. I REALLY need to get this working
and have spent hours (and hours) trying things, researching, and trying more
things, with no luck. THANK YOU.

The reason I need this-- I have several users who send 400+ emails a month
to customers with attachments. In order for their billing reconciliation to
match, they have to remember to send a copy of these emails WITHOUT the
attachments to the billing personnel who runs a reconciliation procedure to
match emails sent to customers against a database. If the user forgets to
send the email (they reply with different addressees so the attachments are
not sent), then it causes a reconciliation check, an email has to be sent to
the user asking for a copy of the email, the user has to send it and someone
tracks that it's received. My intent: after the user sends the email to
their customer, the rules wizard would automatically move the sent email
(based on words in the subject) to a folder, then the sub procedure would run
sending a reply to the appropriate billing people.

My code:

CODE IS IN “THISOUTLOOK SESSION”

Option Explicit
Dim WithEvents ReplyToItItems As Items

Private Sub Application_Startup()
Dim ns As Outlook.NameSpace

Set ns = Application.GetNamespace("MAPI")
Set ReplyToItItems = ns.Folders.Item("Personal
Folders").Folders.Item("test").Items

End Sub


Sub ReplyToItItems_ItemAdd(ByVal Item As Object)
' when a new item is added to "test folder" it is processed

Dim myReply As MailItem

Set myReply = Item.Reply
With myReply
.To = "
.Send
End With

End Sub

Private Sub application_quit()
Dim ns As Outlook.NameSpace
Set ReplyToItItems = Nothing
Set ns = Nothing
End Sub

=======

"Alan Moseley" wrote:

If your script is written within Outlook VBA then it should be possible to
write your code so that the warnings do not appear. Do you have any lines of
code similar to:-

Set objOutlook = New Outlook.Application
or
Set objOutlook = CreateObject("Outlook.Application")

If so then try changing this to:-

Set objOutlook=Outlook

If you then create further objects from this, such as:-

Set objNamespace = Outlook.GetNameSpace("MAPI")
Set objContacts = objNamespace.GetDefaultFolder(olFolderContacts).It ems

and so on, you will prevent the security warning from being shown as
'Outlook' is an in-built object that picks up a reference to the currently
running Outlook application.

If you need any further assistance then post your code and I will see what
needs changing.
--
Alan Moseley IT Consultancy
http://www.amitc.co.uk

If I have solved your problem, please click Yes below. Thanks.


"laavista" wrote:

I went through the steps you outlined multiple times, and there's no "run a
script" rule. I wonder if my company "turned off" this option?

I was hoping to use this as the VBA procedure I wrote results in the Outlook
Security Warning and is useless because of the warnings (my user would have
to click 'yes' 400+ times a month). I thought by using the RunAScript rule
it may prevent the warnings.

Thanks for responding.



"Alan Moseley" wrote:

In Rules and Alerts click New Rule
Click 'Start From A Blank Rule' and choose a Step 1 option. Click Next
Select one or more conditions and click 'Next'
Under Select Action you should see an option for 'Run A Script', check it
and click on the 'a script' hyperlink in the bottom window.
Choose the script that you wish to run.
Continue the remainder of the wizard.

--
Alan Moseley IT Consultancy
http://www.amitc.co.uk

If I have solved your problem, please click Yes below. Thanks.


"laavista" wrote:

I'm using Outlook 2003. I purchased an Outlook VBA book, and it shows
examples of using the rules wizard "run a script". I do not see this option
when I go into rules, and I would really like to use it.

Any suggestions?

Thanks, in advance, for your help.

Ads