Outlook Custom Form Scripting only working when clicking on "Run this form"

Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
So, I just added a new basic code to my custom form (using "show code"), and when I try to run the form through the "Run this form" button, the code works just fine (a simple MsgBox when pressing a button).

The issue is why I try to run the form through VBA and then pressing on the same button. Basically, the form opens just fine, but any of the codes does work.

I've went on options, and checked the "allow scripting on shared folders" and "allow scripting on public folder" boxes and that did not work as well. I also created the keys that disable custom form scripting.

The VBA code I'm using to open the custom form:
Public Sub AddMyForm()
Dim Items As Outlook.Items
Dim Item As Object
Set Items = Application.ActiveExplorer.CurrentFolder.Items
Set Item = Items.Add("ipm.task.test")
Item.Display
End Sub
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
You added all of the necessary keys? You need ot enable it and also add a key for the form.

Same bitness:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\16.0\Outlook\Security
DWORD: DisableCustomFormItemScript
Value: 0 (to enable)

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\16.0\Outlook\Forms\TrustedFormScriptList
REG_SZ: IPM.Contact.custom-form-name
Value: (leave blank)


32-bit office/64-bit windows:
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\16.0\Outlook\Security
DWORD: DisableCustomFormItemScript
Value: 0 (to enable)

HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\16.0\Outlook\Forms\TrustedFormScriptList
REG_SZ: IPM.Contact.custom
Value: (leave blank)



 
Top