none
Outlook Forms Code doesn't work RRS feed

  • Question

  • Well guys, first of all i want to tell you that I'm a complete novice at Outlook Forms. I've been searching about them and I'm starting to think that they are no longer being used.

    Another thing I want to emphasize is that my english is not the best, so sorry if i make some mistakes.

    Now, Knowing that, the tittle is really clear, i'm trying to make a button click or the Form Open do ANYTHING, but i just can't make it work, i'm using code as simple as 

    Sub Item_Open()
      msgbox "Hello World"
    End Sub

    or 

    Sub CommandButton1_Click()
      msgbox "Hello World"
    End Sub

    But it doesn't work at all. Are Outlook forms with code disabled? Because simple outlook forms with no code at all work kinda perfectly for me. I really need help people. Maybe I'm drowning in a glass of water, but documentation I found isn't working for me.


    • Edited by xlordjorox Friday, November 3, 2017 4:42 PM
    Friday, November 3, 2017 4:39 PM

Answers

  • Custom form script is now disabled by default. From https://support.office.com/en-us/article/Fixes-or-workarounds-for-recent-issues-in-Outlook-for-Windows-ecf61305-f84f-4e13-bb73-95a214ac1230?ui=en-US&rs=en-US&ad=US:

    Last updated: Oct 13, 2017        

    ISSUE        

    Custom form script is now disabled by default and requires setting registry keys to re-enable it.

    1. The new registry key has a default value of 1, which indicates form script should not run.

      First create this key:

      32 bit Office on 64 bit Windows            

      HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\16.0\Outlook\Security            

      32 bit Office on 32 bit Windows or 64 bit Office on 64 bit Windows            

      HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\16.0\Outlook\Security

      Then create DWORD (32-bit) Value 0 and set the name to DisableCustomFormItemScript to enable custom form scripts.

      <meta content="1" itemprop="position" />          
    2. Once custom form scripts have been enabled at all, they must then be enabled per form message class. For instance, if you have a form with the message class IPM.Note.Custom, we must register “IPM.Note.Custom” as a trusted form message class. To do this, first create this key:

      32 bit Office on 64 bit Windows            

      HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\16.0\Outlook\Forms\TrustedFormScriptList            

      32 bit Office on 32 bit Windows or 64 bit Office on 64 bit Windows            

      HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\16.0\Outlook\Forms\TrustedFormScriptList

      <meta content="2" itemprop="position" />          

    Then, create REG_SZ values in this key for each form you wish to allow scripts to run. In the above example, you would create a REG_SZ value named “IPM.Note.Custom” with empty data.

    When designing a form, Run This Form will run a form using the message class of the base form. So if you started designing an IPM.Note form and want to Run This Form, you will need to have IPM.Note registered. After you publish, the published message class is what will be checked. Once you have finished designing your form and published it to a custom form name, remove the standard “IPM.Note” from the trusted list.

    Notes: 

      • You need to restart Outlook after setting the TrustedFormScriptList key.

      • The example registry keys use 16.0 for Outlook 2016. Use 15.0 for Outlook 2013, 14.0 for Outlook 2010 and 12.0 for Outlook 2007.

    After making the above changes the registry keys will look like the following:

    [HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\16.0\Outlook\Security]

    DisableCustomFormItemScript"=dword:00000000

    [HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\16.0\Outlook\Forms\TrustedFormScriptList]

    "IPM.Note.Custom"=""

    "IPM.Note"=""

    Registry keys

    Registry keys

    NOTE: In some cases forms in secondary mailboxes and Public folders still don't work after the registry key settings. To fix this, enable scripts in the Trust Center:

    1. Click File > Options. Then select Trust Center > Trust Center Settings > Email Security.

      <meta content="1" itemprop="position" />          
    2. Under the Script in Folders section, click the checkbox for Allow script in shared folders and Allow script in Public folders and click OK and OK again to close out the windows.

      <meta content="2" itemprop="position" />          

    STATUS        

    The change was first introduced in the September 12th, 2017 Outlook Public Updates and is included in the following MSI updates which now require the registry keys.

    Outlook 2007        

    Outlook 2010        

    Outlook 2013        

    Outlook 2016        

    Click to Run status is as follows:

    1. Monthly Channel (Current Channel) will start supporting the registry keys in the update scheduled for September 18th release build 16.0.8431.2079.

      <meta content="1" itemprop="position" />          
    2. Semi-Annual Channel (FRDC) supports the registry keys with build 16.0.8431.2079.

      <meta content="2" itemprop="position" />          
    3. Deferred Channel supports the registry keys with build 16.0.8201.2193.

      <meta content="3" itemprop="position" />          
    4. Deferred Extended status is TBD.

      <meta content="4" itemprop="position" />          
    5. Insider Fast status is TBD.

      <meta content="5" itemprop="position" />          
    6. Insider Slow supports the registry keys with build 16.0.8431.2079.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    • Marked as answer by xlordjorox Friday, November 3, 2017 6:54 PM
    Friday, November 3, 2017 5:40 PM

All replies

  • Custom form script is now disabled by default. From https://support.office.com/en-us/article/Fixes-or-workarounds-for-recent-issues-in-Outlook-for-Windows-ecf61305-f84f-4e13-bb73-95a214ac1230?ui=en-US&rs=en-US&ad=US:

    Last updated: Oct 13, 2017        

    ISSUE        

    Custom form script is now disabled by default and requires setting registry keys to re-enable it.

    1. The new registry key has a default value of 1, which indicates form script should not run.

      First create this key:

      32 bit Office on 64 bit Windows            

      HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\16.0\Outlook\Security            

      32 bit Office on 32 bit Windows or 64 bit Office on 64 bit Windows            

      HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\16.0\Outlook\Security

      Then create DWORD (32-bit) Value 0 and set the name to DisableCustomFormItemScript to enable custom form scripts.

      <meta content="1" itemprop="position" />          
    2. Once custom form scripts have been enabled at all, they must then be enabled per form message class. For instance, if you have a form with the message class IPM.Note.Custom, we must register “IPM.Note.Custom” as a trusted form message class. To do this, first create this key:

      32 bit Office on 64 bit Windows            

      HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\16.0\Outlook\Forms\TrustedFormScriptList            

      32 bit Office on 32 bit Windows or 64 bit Office on 64 bit Windows            

      HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\16.0\Outlook\Forms\TrustedFormScriptList

      <meta content="2" itemprop="position" />          

    Then, create REG_SZ values in this key for each form you wish to allow scripts to run. In the above example, you would create a REG_SZ value named “IPM.Note.Custom” with empty data.

    When designing a form, Run This Form will run a form using the message class of the base form. So if you started designing an IPM.Note form and want to Run This Form, you will need to have IPM.Note registered. After you publish, the published message class is what will be checked. Once you have finished designing your form and published it to a custom form name, remove the standard “IPM.Note” from the trusted list.

    Notes: 

      • You need to restart Outlook after setting the TrustedFormScriptList key.

      • The example registry keys use 16.0 for Outlook 2016. Use 15.0 for Outlook 2013, 14.0 for Outlook 2010 and 12.0 for Outlook 2007.

    After making the above changes the registry keys will look like the following:

    [HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\16.0\Outlook\Security]

    DisableCustomFormItemScript"=dword:00000000

    [HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\16.0\Outlook\Forms\TrustedFormScriptList]

    "IPM.Note.Custom"=""

    "IPM.Note"=""

    Registry keys

    Registry keys

    NOTE: In some cases forms in secondary mailboxes and Public folders still don't work after the registry key settings. To fix this, enable scripts in the Trust Center:

    1. Click File > Options. Then select Trust Center > Trust Center Settings > Email Security.

      <meta content="1" itemprop="position" />          
    2. Under the Script in Folders section, click the checkbox for Allow script in shared folders and Allow script in Public folders and click OK and OK again to close out the windows.

      <meta content="2" itemprop="position" />          

    STATUS        

    The change was first introduced in the September 12th, 2017 Outlook Public Updates and is included in the following MSI updates which now require the registry keys.

    Outlook 2007        

    Outlook 2010        

    Outlook 2013        

    Outlook 2016        

    Click to Run status is as follows:

    1. Monthly Channel (Current Channel) will start supporting the registry keys in the update scheduled for September 18th release build 16.0.8431.2079.

      <meta content="1" itemprop="position" />          
    2. Semi-Annual Channel (FRDC) supports the registry keys with build 16.0.8431.2079.

      <meta content="2" itemprop="position" />          
    3. Deferred Channel supports the registry keys with build 16.0.8201.2193.

      <meta content="3" itemprop="position" />          
    4. Deferred Extended status is TBD.

      <meta content="4" itemprop="position" />          
    5. Insider Fast status is TBD.

      <meta content="5" itemprop="position" />          
    6. Insider Slow supports the registry keys with build 16.0.8431.2079.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    • Marked as answer by xlordjorox Friday, November 3, 2017 6:54 PM
    Friday, November 3, 2017 5:40 PM
  • I am not able to find those registry keys. I had already found that information. Maybe I am not searching correctly, or I'm not able to change it so its not enabled for me. However your answer is correct, thank you for taking the time to answer me.

    Sorry for my english, again.

    Friday, November 3, 2017 7:01 PM
  • The registry values need to be created.

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Friday, November 3, 2017 7:17 PM
  • HI Dmitry,

    I've done everything as described - have created both registry sets - for Outlook x32 and x64 (just in case, although I have 64bit Office on a 64bit Windows 10). Made no difference - still I am able to run the script(from the Macro's view), but can't trigger it by a checkbox click on the custom form.

    Any further ideas?

    Thursday, August 15, 2019 3:03 PM
  • Hi Dmitry,

    I have messageclass dynamically generated, for example:

    "IPM.Note.MyProduct.subproduct001" where "subproduct001" is dynamically generated...

    how I could solve this scenario?

    thanks a lot,

    Mauricio.


    Mauricio

    Tuesday, December 3, 2019 5:00 PM