OutLook VbaProject.OTM Macro events is Invalid RRS feed

  • Question

  • In Outlook VBA, events are not triggered. You need to open VBA once and the events start triggering the macro to run. Events need ALT+F11 to open the OutLook VBA IDE. These events will respond normally. Want to understand what caused this situation? Is there a solution? (About the Trust Center part, the macro runs with a certificate.)

    there is my dev step:

    1, Machine A : Create VBA Macro in OutLook VbaProject.OTM

    2, Machine B : Close OutLook Program.

    3, Machine B : Copy VbaProject.OTM from Machine A to <AppData>\Microsoft\Outlook\ folder.

    4, Machine B : Start OutLook Program , when Send a Mail, then Macro is Invalid。

    5, Machine B : In OutLook Window and Press ALT + F11 open the VBA IDE , then Close OutLook Program.

    6, Machine B : Start OutLook Program , when Send a Mail, then Macro is OK。

    Monday, March 19, 2018 8:40 AM


All replies

  • Hello,

    Looks like you need to assign event handlers correctly on another machine. 

    Anyway, VBA macros are not designed for distributing your solutions on multiple machines. Instead, I'd recommend developing a COM add-in (for example, VSTO based one). See Walkthrough: Creating Your First VSTO Add-In for Outlook for more information. 

    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    • Proposed as answer by Terry Xu - MSFT Tuesday, March 20, 2018 3:04 AM
    • Marked as answer by yrs19 Friday, March 23, 2018 4:07 AM
    Monday, March 19, 2018 4:21 PM
  •  thank you very much.

     I used the following method to activate Marco:

     In fact, it is automatic to open outlook.exe and press Alt+F8。


    Dim ProgramFiles_folder, strOutlookCmd 
    ProgramFiles_folder = WsShell.ExpandEnvironmentStrings("%ProgramFiles%")  
    strOutlookCmd = """" & ProgramFiles_folder & "\Microsoft Office\Office12\OUTLOOK.EXE" & """" & " /altvba " & """" & "%AppData%\Microsoft\Outlook\CustomVbaProject.OTM" & """"  
    WScript.Echo strOutlookCmd  
    Dim oOutlook  
    Set oOutlook=WsShell.Exec(strOutlookCmd)  
    WScript.Sleep 3000  
    WsShell.AppActivate oOutlook.ProcessID  
    WsShell.SendKeys "%{F8}"  
    WScript.Sleep 500  
    WsShell.SendKeys "{ESC}"  
    WScript.Sleep 500  
    WsShell.SendKeys "%{F4}"  
    WScript.Sleep 500  
    Set oOutlook = Nothing 

    Friday, March 23, 2018 4:06 AM
  • Hi 

    take a look to this registry key



    Have a nice day. Oliv-

    Friday, March 23, 2018 10:51 PM