Debugging an Outlook 2007 script fired by a rule

前端 未结 2 795
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-03 14:35

I\'m trying to debug an Outlook 2007 VBA script that\'s fired by a rule. I\'ve set a breakpoint in the script but it doesn\'t get hit.

The script is actually a

2条回答
  •  隐瞒了意图╮
    2020-12-03 15:09

    I think you may not be doing anything wrong, because I have experienced exactly the same behaviour.

    However, in order to debug your VBA, I suggest that you create a macro (via the Tools|Macro|Macros menu) that calls your script function with a test e-mail item that you create in the macro.

    Maybe something like this:

    Sub TestScript()
        Dim testMail As MailItem
        Set testMail = Application.CreateItem(olMailItem)
        testMail.Subject = "Test subject"
        testMail.Body = "Test body"
        Project1.ThisOutlookSession.YourScriptForDebugging testMail
    End Sub
    

    This way you can "Step Into" the macro via that Macro dialog again, and do all the debugging you need. It solved my problem, anyway.

提交回复
热议问题