NewInspector questiob

  • Thread starter Thread starter mkboynton via OfficeKB.com
  • Start date Start date
M

mkboynton via OfficeKB.com

Can someone tell me why this does not write to the message body? I am
stumped! I have placed it in the ThisOutlookSession.

Public WithEvents colInsp As Outlook.Inspectors
Public WithEvents objInsp As Outlook.Inspector

Public Sub Initialize_handler()
Set colInsp = Application.Inspectors
End Sub

Private Sub colInsp_NewInspector(ByVal Inspector As Inspector)
Dim OrigBody
Dim objItem As Object
Set objInsp = Inspector

Set objItem = objInsp.CurrentItem
If objItem.Subject = "FL DAILY INBOUND SHEET.xls" Then
OrigBody = objItem.HTMLBody
objItem.HTMLBody = "<HTML><H3>" & Format(Date, "MMM. DD, YYYY") &
"</H3></HTML>" & OrigBody
End If
End Sub
 
How are you calling Initialize_handler()? Are you calling it in
Application_Startup()?
 
What are your macro security settings? Select Tools, Macro, Security.
 
Is your Outlook VBA disabled? Look in Help, About Microsoft Office Outlook,
Disabled Items button and see if the VBA addin is disabled. If not can you
set up a test situation to force the code to run, called by a macro, and see
if that code runs.

You really shouldn't use Low security, it's a risk. You're better off being
prompted when Outlook starts if you have macros or to sign the code project
using the Selfcert.exe program that's part of Office and set your security
to medium.
 
VBA is not disabled. I can add a msgbox in the code and it will fire, but it
does not put the date in the body of the email.
 
Then I'd suggest stepping the code from a breakpoint and seeing what's going
on. See if there are any errors.
 
Back
Top