NewInspector questiob

  • Thread starter mkboynton via OfficeKB.com
  • 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
 
K

Ken Slovak - [MVP - Outlook]

How are you calling Initialize_handler()? Are you calling it in
Application_Startup()?
 
K

Ken Slovak - [MVP - Outlook]

What are your macro security settings? Select Tools, Macro, Security.
 
K

Ken Slovak - [MVP - Outlook]

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.
 
M

mkboynton via OfficeKB.com

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.
 
K

Ken Slovak - [MVP - Outlook]

Then I'd suggest stepping the code from a breakpoint and seeing what's going
on. See if there are any errors.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top