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.
Every time I'm going through an entire file searching of occurrences of a string, VS shows a poop-up notifying me about that. I've unchecked the option to continue that behavior at number of times - to no avail.
I went to options and unchecked it there as well (see image for verification) but every time I restart VS, the settings in back there - checked and unaffected. I'm out of ideas what to try to remedy it. (Googled it. I haven't found anything that I recognized as useful.)
Those settings are saved (when you close Visual Studio) in this registry key:
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\Find
"ShowEndOfSearch"="1"
"ShowNoFound"="1"
"ShowAllReplacementsNotAllowed"="1"
"ShowSomeReplacementsNotAllowed"="1"
"ShowNoMore"="1"
"ShowFindStart"="1"
"ShowCancel"="1"
"ShowCancelBeforeReplacementsMade"="1"
"ShowReplaceInFilesWarning"="1"
Do you have access to that key? Try setting these values to "0" in regedit.
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.
I developed a small VBA procedure in MS Access 2003 module (just one public Sub)
The database is locked for me only, nobody else has access to the file.
My code works but there is a small bug I want to find and fix
I need to debug my VBA code. I put breakpoint at the first line of the procedure.
However, when I run this code, it never stops at the breakpoint and never enters to debug mode. Seems like VBA debugger is not working or disabled. I was not able to find any option how it is possible to disable/enable VBA debugger, I supposed it should be always enabled. Now I can debug this code only with the help of putting a lot of message boxes, but it takes a lot of time...
Please see:
ACC2002: Breakpoints Are Ignored in Visual Basic for Applications Code
Enable the Use Special Access Keys startup option.
To do so, follow these steps:
Open the database in which the breakpoint has been set.
On the Tools Menu, click Startup.
In the Startup dialog box, click to select the Use Special Access Keys
check box.
Click OK to close the Startup dialog box.
Close and then reopen the database.
Run the code that contains the breakpoint. Note that execution of the
code pauses at the breakpoint, as you
would expect.
Office 2010 Steps to resolve:
File
Options
Current Database
Make sure "Use Access Special" is checked.
Close and reopen Database.
I'm facing some troubles still while learning, so I guess it tends to get worse once I play with the big kids: warnings in dynamics aren't as precise and informative as VS's, there are no mouse-over tips, and exceptions to show me exactly where I've got it wrong.
I'm just too used to Visual Studio, it's intellisense and all the tools (dynamics is quite new when compared to Visual Studio)
More than solving simple code issues, i'd like to learn how to solve upcomming ones i might have in code not written by me or anything else i'd solve in 3 minutes in Visual Studio, as well as tips on how to survive in dynamics ax without all the Visual Studio tools.
The code editor in Dynamics AX has some intellisense, typing the name of a table or class variable followed by . or :: will give you a list of fields or methods available for that item. After you type the ( to start a method call, a tooltip pops up with parameters available on that method. When starting a new line, you can right click and List Tables, List Classes, List Types, etc. Most of those commands are also available via Shortcut Keys. Note that the intellisense only works if all the code in the method up to the location of your cursor is syntactically correct.
Make sure you have updated the cross reference in your development environment (Tools/Development tools/Cross-reference/Periodic/Update). With an updated cross reference, you can right click an any table, field, class, method, extended data type, or enum in the AOT and choose Add-Ins/Cross-reference/Used by to see where that item is used in the system.
You can also use Tools/Development tools/Code explorer to view the source to the application with all types, variables, and methods turned into hyperlinks so you can click to go right to the definition of that item.
Another useful tool is Application hierarchy tree, available either under Tools/Development tools, or on the right click Add-Ins menu. This will show you the class hierarchy, so you can easily see, for example, that SalesFormLetter derives from FormLetter, which derives from RunBaseBatch.
In the editor, you can highlight text and right click to Lookup Properties/Methods or Lookup Definition.
If you are trying to track down where in the system a particular infolog message is generated there are two strategies to use:
Set a breakpoint on the first line
of the method Info.add(). Then when
you run the code generating the
message, you will pop into the
debugger as soon as the infolog is
generated. You can then look at the stack
trace in the debugger to see where the code is that
generated the message.
Run Tools/Development
tools/Label/Label editor and search
for the text of the message. Select
the Label ID of the message, then
click Used by to see where that
message is used in the system.
There is also http://www.axassist.com/ which extends intellisense and many other extensions
What these guys said already is very interesting and helpful.
I'd like to add that within AX in real life you are probably working with multiple contexts. e.g. Code running in the client, code running in server, code running in p-code and in IL, COM integrations, Enterprise portal and so on.
My point is, if you want to figure something out through debugging, you must first understand where the code(s) you'd like to debug is running.
Knowing that is important because you might have to allow debugging or give permissions in multiple places.
Examples:
Windows AD debugging users (add yourself)
Allow debugging on client
Allow it on server
Disable IL if you want to use MorphX, otherwise attach the process in VS.
Allow World Wide Web Publishing Service to interact with desktop for EP.
One last thing, you are starting to work with ax right now, perhaps you will need to work with AX7(Dynamics 365 for Operations). This version of the system works only with visual studio. It is still x++, but you have a lot of the things VS provides you.
Take a look on EditorScripts Class,On AX Editor you can use it by right click and choose "Scripts". It is a kind of intellisense that can make by your self, for example: here is my in-line comment whenever I type "mycom" and press "tab"
public void template_flow_mycom(Editor editor)
{
xppSource xppSource = new xppSource(editor.columnNo());
int currentline = editor.currentLineNo();
int currentcol = editor.columnNo();
Source template = "//Partner comment "+date2str(today(),123,2,1,3,1,4, DateFlags::FormatAll )+" at "+time2str(timenow(), 1, 1)+" by MAX - Begin\n";
template+=strRep(" ", currentcol)+ "\n";
template+=strRep(" ", currentcol)+ "//Partner comment "+date2str(today(),123,2,1,3,1,4, DateFlags::FormatAll )+" at "+time2str(timenow(), 1, 1)+" by MAX - End\n";
editor.insertLines(template);
//move cursor to the empty line between the comments
editor.gotoLine(currentline+2);
editor.gotoCol(currentcol+4);
}