Outlook form VBScript won't run - vbscript

I'm designing a Outlook Contact form. None of the sample code I've tried to put in the View Code button's Script Editor does anything. The most basic example is:
Sub Item_Open()
msgbox "Hello World"
End Sub
When I click the Run This Form button, no message box or error message appears. It seems to totally ignore the VBScript. The same thing happens with every bit of sample code I've tried.
This is my first time doing any development for Office or in VBA or VBScript, so I assume I'm missing something basic, but I've watched and read a few tutorials, doing exactly what was shown and nothing works. I can design and publish a Contact form with custom fields and and basic combo boxes.
In the Trust Center I have Macro Settings set to "Notifications for all macros" and the Email Security options "Allow script in shared folders" and "Allow script in Public Folders" are both checked.
I'm designing a Contact form using Office 365 32-bit Version 1708 (Build 8431.2079 Click-to-Run) Monthly Channel on Windows 10 x64 Version 1703 Build 15063.608.
Any help would be greatly appreciated!!
Thank you!

The solution was to add some registry keys as described in the 2 articles below.
Custom form scripts now require registry settings to be added.
https://support.office.com/en-us/article/Custom-form-script-is-now-disabled-by-default-bd8ea308-733f-4728-bfcc-d7cce0120e94
https://www.slipstick.com/outlook/custom-form-security/
The registry settings mentioned there fixed my issue.

Possible causes:
VbScripting is not enabled on your machine, disabled there in Registry, especially on Windows 10. You have to enable there.
Though VbScript is enabled and you can run scripts directly from a file in a Folder like sample.vbs, script may not run on Outlook Custom Form if Outlook application has security setup in Registry Key when installed.
I faced this problem and solved after several attempts.

Related

Not Showing Outlook Addin

I have created outlook addin for Outlook 2013 64 bit.
In that Addin, i have created Form region with custom controls.
Then with the reference of http://blogs.msdn.com/b/emeamsgdev/archive/2013/11/21/outlook-deploying-an-outlook-2013-add-in-using-installshield-le.aspx i created setup file for Addin.
Now i installed it in my computer and everything works fine.
However when i try to install it on client computer, it doesn't show addin in outlook.
and i am not able to find any reason.?
I have also created registry for my addins
If it simply doesn't load, without errors, it only means one thing, outlook is unaware of your addin, cause even when addins are not working, outlook gives you an error or turns the LoadBehaviour regkey to '2'.
On your client, you should check that the registry values are set properly.
**HKEY_CURRENT_USER\Software\Microsoft\Office\Outlook\Addins\Outlook_PROJECT_ADDIN
If your addin doesn't work, check to see if those values exist, and if they do, what happens when outlook loads ? does LoadBehavior turns to '2' instead of 3 ?
If so, and it works perfectly on your pc, it probably means you have issues with the Manifest regkey, make sure the manifest points to a valid local location followed by a |vstolocal
so its syntax should be something like:
file:///C:/Outlook_Proj.vsto|vstolocal
Also make sure you have .Net Framework v4.0 installed on your target PC.
If you're trying to install it to a network drive, make sure you remove the '|vstolocal| thingy, and add the network drive to the trusted zone in Internet Explorer Settings.
Hope the following steps will help you solve this problem if you are still facing it.
Run the deployed setup with administration rights.
If it is not shown under Add-ins, open the setup folder and double click on the .vsto file then select install.
If you can see the addin among the others, and is not functioning it means it is disabled. To enable the add-in(since you are using outlook 2013), go to File -> Slow and Disabled Add-ins, and you shold see your add-in on the pop-upped window. Enable it.
Create the VSTO_SUPRESSDISPLAYALERTS = 0 enviorment variable to get any VSTO alerts. Take a look in the Windows event viewer and off course be sure of being installed the pre requisistes like Office Primary assembles and VSTO for office. Another think, check if your adding was not crashed once and move to inactive add-in list. Search registry for Resiliency key.

VS Express 2013 for Web - Browser is security restricted or JavaScript is disabled

I initially installed the Microsoft Visual Studio Express 2013 for Web on my desktop. My desktop runs Windows 8.1 with internet explorer 11. It ran fine until the license expired after the first 30 days. I tried to sign in to renew the license, however after clicking the 'sign in' button I get an error dialog. The dialog states 'Browser is security restricted or javaScript is disabled. I have no other option but to close and exit Visual Studio.
I went to the online forums for Microsoft. There were discussions and suggestions on how to fix the error. I tried lowering the settings for the security tab in internet explorer. I have validated the option for scripting is enabled. I have also added https://*.visualstudio.com to the trusted sites tab. Other users on the forum have tried the same suggestions and have not succeeded in signing into the visual studio application.
I had exactly the same problem, here is what I did:
a) Go in IE, click on settings wheel then Internet Options and Security tab.
b) Click on Custom level button (make sure you select Internet zone).
c) In Security Settings window, under Scripting I set Enabled for Active scripting.
After that Sign In should work. Even though Chrome is default browser, it seems that VS uses IE for sign in process.
Hope this helps!
There is another issue people are running into that is a bug with the login dialog. The login dialog is using a Web Browser control to login the user. By default it loads up "about:blank" as the URI. It then proceeds to try to execute some JavaScript (just ";") to verify it has permissions to do so. On some machines this is problematic because "about:blank" has been mapped to zone 0, or the Local Machine zone. When the JavaScript is executed MSHTML will check the zone of the URI and then the policy for executing scripts. By default the Local Machine zone is locked down, and all script executions result in a Query policy. What this means is if you're running in immersion mode (aka in Internet Explorer) you will get a message box asking if you want to execute the script. However, the Web Browser control used by VS 2013's "Sign In" dialog doesn't run MSHTML code in immersion mode, so the Query policy effectively equates to a Disallow policy. The bug here is someone in VS assumed "about:blank" resolves to the Internet zone, and when it resolves to the Local Computer zone you get this behavior.
The workaround is to remove "about:blank" zone mapping. Point regedit to this key:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains]
Remove the "blank" key.
Alternatively you can change the Local Machine Lockdown policy for executing scripts. The reg key for that is:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Lockdown_Zones\0]
Set the "1400" DWORD value to 0.
There are many sites you need to list in your Trusted Sites. Following the trace of what the stupid, stupid login script does:
https://.visualstudio.com
https://app.vssps.visualstudio.com
https://.accesscontrol.windows.net
https://auth.gfx.ms
https://login.live.com
Only then was I able to log on to my FREE software.
Hi this is Albert from Microsoft. Just want to let you all know that this issue has been fixed in the upcoming Update 2 for Visual Studio 2013. Thanks for your patience while we figured this one out :)
Same problem "Browser is security restricted or JavaScript is disabled" here but the solution from #jic didn't work for me..
If you can and it is convenient for you this is a solution which worked for me:
I have created a new user/profile on my PC and for this user it was just working fine.
Before this action I have tried to make an user account which had this problem as:
Power user - didn't work
Administrator - didn't work as well
So the last solution in my case was a brand new user on the PC..
Here's what worked for me.
Open Control Panel, Internet Options.
First, I clicked the Security tab and turned security the security for the Internet zone to its minimum.
Next, click the Privacy tab, then click Advanced. Choose "Accept" for both types of cookies.
Of course you can change these all back after extending your VS trial.
you must change secure settings of iexplore for admin account. If logon by other account, you must start iexplore under admin account or logon under admin account, because you will get license after admin account.
Click on Start --> Run --> type cmd and click on OK.
Command Prompt will be opened. Then enter this command.
ipconfig /flushdns
and press Enter.
Now try to access https://app.vssps.visualstudio.com/Profile/View
It worked for me...
As I can not add a comment yet to the answer of CBGraham, I've to add this note over here:
The solution described from CBGraham worked for me (Thanks Graham). I had to add an additional link:
https://account.live.com
Then I opened the IE and tried to login to a Microsoft site. I left the IE window open and just clicked once again on the VS to login. Then it worked for me. Even with strong restrictions on the IE settings. While I'm surprised why someone should set down his security settings, just to register VS.

The macro cannot be found or has been disabled because of your Macro security settings

I am getting the error that appears in the title and I already check the security settings, I have everything enabled and the Add-in is signed. I put the screenshot of how I have the options. If I have everything enable why it can give security problems?
I am using windows 8 and office 365. And the add-in that is not working is a powerpoint add-in. I try also some solutions that appears in this thread but no one works for me: http://social.technet.microsoft.com/Forums/office/en-US/0b385af0-9856-4cfb-bc48-3369c3ce2ace/when-opening-ms-word-the-macro-cannot-be-found-or-has-been-disabled-because-of-your-macro-security?forum=officeitproprevious
I had the EXACT same problem with an addin which I developed for Powerpoint many years ago and now ran on some computers at my new company, but not others.
The support couldn't help me and Google couldn't really help me, but this thread came closest to describing my situation.
The only common denominator I eventually found was that 32-bit Office could run the addin, but not 64-bit.
So my solution was to go through the VBA source code and replace my declaration variables according to this Microsoft post:
https://msdn.microsoft.com/library/gg264421.aspx
Maybe that could help you as well?
Create a simple PowerPoint presentation and save it as pp_HelloWorld.pptx
Add the following VBA procedure
Option Explicit
Sub sbHelloWorld()
MsgBox "Hello World!"
End Sub
to a module in this presentation and save it as pp_HelloWorld.pptm
Close and reopen this presentation pp_HelloWorld.pptm and the macro will work from the Developer > Macros > Run option
Put the following custom ribbon code
<mso:customUI xmlns:mso='http://schemas.microsoft.com/office/2009/07/customui'>
<mso:ribbon>
<mso:qat/>
<mso:tabs>
<mso:tab id="mso_c1.2A492F1" label="New Tab">
<mso:group id="mso_c2.2A492F1" label="New Group" autoScale="true">
<mso:button id="sbHelloWorld" label="sbHelloWorld" imageMso="ListMacros" onAction="sbHelloWorld" visible="true"/>
</mso:group>
</mso:tab>
</mso:tabs>
</mso:ribbon>
</mso:customUI>
into a file called PowerPoint.officeUI
and put this file in the folder
C:\Users<username>\AppData\Local\Microsoft\Office
(this may be hidden initially)
Close and reopen this presentation pp_HelloWorld.pptm and the macro will work from the Developer > Macros > Run option
The macro will not work from the macro button New Tab > sbHelloWorld and gives the message -
"The macro cannot be found or has been disabled because of your Macro security settings"
Next Clear the Trusted Documents -
Developer > Macro Settings > Trusted Documents > Clear
The macro now works from the macro button New Tab > sbHelloWorld.
This works on Windows 10 with Office 365
I found that this happens when normal.dotm has become corrupt. So the best and quickest solution is to restore the normal.dotm from a recent backup.

outlook addin goes straight to inactive application addins

My Outlook addin MSI installs the addin (It is listed in Add\Remove programs) but sends it straight to inactive application addins.
How can I fix this?
Check the LoadBehavior key value for your plugin.
HKEY_CURRENT_USER\Software\Microsoft\Office\Outlook\Addins\%your add in%\LoadBehavior
If you see the registry hive for you add-in - it's most likely to be installed correctly.
The LoadBehavior value should be 3 before you start Outlook. If it's not, set it to 3.
If it goes to 2 when you start Outlook - it is definitely trying to run it, so it's good news in a way.
You will need to do some diagnostics there - try instantiating your add-in from vbs
set c = CreateObject("EnthusiasticDeveloper.OutlookAddIn")
This should give you no errors.
If it doesn't and the object is instantiated - you need to put diagnostics in your add-in.
It is being called by Outlook and your most likely to get enough control to instantiate log4net.
HTH
It seems the MS Outlook started evaluating the add-ins that directly affect product overall performance and set them as inactive. I found this article that indicates the windows registry entry for DisabledItems (HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook\Resiliency\DisabledItems). It is much likely to your add-in be listed on this folder. Backup the related entry before removing it.
See detailed information on this accessing:
http://www.outlook-apps.com/inactive-outlook-add-ins/
Cheers,
Vieira
This probably happens because the load behavior is not set correctly. This article can help you: http://msdn.microsoft.com/en-us/vsto/ff937654.aspx#Create

Create a user in Active Directory from an Infopath form

I've been searching the web for a while now and still can't seem to find anything useful on this topic.
What I am trying to create is a button in my Infopath form that will create a user account in Active Directory. The code will need to pull through information stored in the fields of the Infopath form.
I have chosen to use Visual Basic, as I believe that is a good language scripting with AD.
I have successfully run this code:
Sub CTRL1_12_OnClick(eventObj)
MsgBox "Output: "
End Sub
which returns: 'Output: ' in a VB dialogue box when I click on my infopath button. However, when I try:
Set objOU=GetObject("LDAP://OU=People,OU=contoso,DC=contoso,DC=com")
Set objUser=objOU.Create("user","CN=Linda Mitchell")
objUser.Put "sAMAccountName","linda.mitchell"
objUser.SetInfo()
All I get is an error message in Infopath:
The following error occurred:
ActiveX component can't create object:
'GetObject' File:script.vbs Line:14
When I put the same code in to notepad, save as a vbs file and then execute is runs fine and create a user in active directory, what I don't understand is why when I run the same code it doesn't work.
I would recommend you check out Richard Mueller's web site - he has tons of VBScript code to do all sorts of AD stuff.
Here's a link to a page showing how to create users - is that of help?? I'm not much of a VBScript programmer, but I know Richard's stuff is usually very good and useful.
Here's his entire list of free VBScript code for you to go rummage about!
I have now found out what the problem was. I needed to set the form to 'full trust' Tools>form options> Security and Trust. I also had to sign the form with my certificate.
Now I am able to run the code from that button.

Resources