Cannot get my code to run in outlook.. after restarting any of the event handlers do not fire for so

  • Thread starter Thread starter David
  • Start date Start date
D

David

This routine is under my CurrentOutlookSession....

Sub Application_Reminder(ByVal Item As Object)

If TypeOf Item Is AppointmentItem Then
'create subject line
Dim subject1 As String
subject1 = "Appointment Reminder: " & Item.subject
'Call new AppoinmentMail to send email
NewReminders.NewAppointmentMail subject1
End If

If TypeOf Item Is TaskItem Then
'create subject line
Dim subject2 As String
subject2 = "Task Reminder: " & Item.subject
'Call new TaskMail to send email
NewReminders.NewTaskMail subject2
End If

End Sub

And then there is a module that contains the two functions to send an
email to myself whenever a reminder pops up. Any suggestions

Public Function NewAppointmentMail(subject As String)
'Creates and tries to send a new e-mail message.

Dim objNewMail As Outlook.MailItem

Set objNewMail = Application.CreateItem(olMailItem)
objNewMail.subject = subject
objNewMail.Body = "This e-mail message was created automatically
on " & Now
objNewMail.To = "(e-mail address removed)"

If objNewMail.IsConflict = False Then
objNewMail.Send
Else
MsgBox "Conflict: Cannot send mail item."
End If
Set olApp = Nothing
Set objNewMail = Nothing

End Function


Public Function NewTaskMail(subject As String)
'Creates and tries to send a new e-mail message.

Dim objNewMail As Outlook.MailItem

Set objNewMail = Application.CreateItem(olMailItem)
objNewMail.subject = subject
objNewMail.Body = "This e-mail message was created automatically
on " & Now
objNewMail.To = "(e-mail address removed)"

If objNewMail.IsConflict = False Then
objNewMail.Send
Else
MsgBox "Conflict: Cannot send mail item."
End If
Set olApp = Nothing
Set objNewMail = Nothing

End Function


I had this running really smooth when I first put it into outlook...
now after a restart of outlook the code doesnt even execute..... its
like the code is not respoding to any of outlooks events.

Thanks for the help in advance

David Fibingr
(e-mail address removed)
 
What is your macro security setting? Tools, Macro, Security? If it's set to
High only signed code will run (you can sign your code using the
selfcert.exe program that comes with Office). Set to Medium you will get a
prompt to OK macros when Outlook starts. Low security will let your code run
without signing it or the logon prompt about macros but is a security risk.
 
I have finally got it going.... I could have sworn I tried playing
with the macro security.. unfortunately I suppose I wasnt restarting
Outlook after the change. After reading your advice though I tried
all options and it started running again.

Thank you so much for help.

David Fibingr
(e-mail address removed)
 
Back
Top