Select the product you need help with
- Internet Explorer
- Windows Phone
- More products
The CreateObject function or the ActiveXObject function may generate a script error in InfoPath
Article ID: 832512 - View products that this article applies to.
You may use the Microsoft VBScript CreateObject function or the Microsoft JScript ActiveXObject function to create an instance of an ActiveX component. If you create the instance of an ActiveX component in a script module of a function call for a Microsoft Office InfoPath form, you may receive one of the following error messages.
Automation Server can't create object
ActiveX Component can't create object
InfoPath forms always run in the context of an Internet security zone. The Internet security zone defines the actions that the script in a form can perform and the actions that the script in a form cannot perform. Typically, this error occurs because the Internet security zone where the form runs does not permit ActiveX components to be created if the ActiveX components are not marked Safe for untrusted script or Safe for untrusted initialization. This means that the author of the control does not certify that the component cannot cause damage to your system if presented with malicious script or malicious data.
For more information about how security zones affect the level of access that forms have to the resources on your computer, click Microsoft Office InfoPath 2003 or Office InfoPath 2007 Help on the Help menu, type About security zones in the Search for box in the Assistance pane, and then click Start searching to view the topic.
To work around this problem in your InfoPath form, use either of the following methods:
Make the form a fully-trusted URN-based formThe fully-trusted URN-based form must be installed on your computer by using a custom install script or by using the Microsoft System Installer package. This permits ActiveX components to be created even if the ActiveX components are not marked Safe for untrusted script or Safe for untrusted initialization.
You can convert a standard form to a URN-based form manually. However, manual conversion is tedious and is prone to errors. You can also convert a standard form to a URN-based form by using the RegForm.exe tool that is the command-line form registration tool that is included with the InfoPath software development kit (SDK). The RegForm.exe tool makes the required changes to the form definition file and to the XML template file. The Regform.exe tool then repackages the files to an .xsn file and then creates a custom installation program for installing the modified form template.
For more information about how to download the InfoPath 2003 SDK, visit the following Microsoft Web site:
http://www.microsoft.com/downloads/details.aspx?FamilyID=351f0616-93aa-4fe8-9238-d702f1bfbab4The default installation location of the InfoPath 2003 SDK is C:\Program Files\Microsoft Office 2003 Developer Resources\Microsoft Office InfoPath 2003 SDK\Tools.
To see the command line options, type the following command line in a Command window:
Notice the use of the /U switch and the /T switch in the command line. The /U switch specifies the URN to use for the form template. The /T switch specifies that the form template is fully trusted. This sets the requireFullTrust attribute in the form definition (.xsf) file to Yes.
The following command line produces a .js file and a .bak file in the same folder as the template that you are converting:
The .bak file is a copy of the original form template file before the URN-based changes. The .js file is a script file that you can use to install the URN-based form.
To run the .js script, type the following code at the command line, and then press ENTER:
For additional information about a URN-based form or about the RegForm.exe tool, see the "Using the Form Registration Tool" topic in the InfoPath 2003 SDK Help documentation.
For more information about InfoPath 2007 and the InfoPath 2007 SDK, visit the following Microsoft Web site:
Add the URL of the server that hosts the InfoPath form to the list of trusted sites in Microsoft Internet ExplorerWhen you add the URL of the server that hosts the InfoPath form as a trusted site, you receive the following message when you run the code: If you click Yes, the code runs. If you click No, you may receive the error messages that are mentioned in the "Symptoms" section, and the code will not run.
To add a site as a trusted site, follow these steps:
Digitally sign a form templateThis applies to InfoPath 2003 Service Pack 1. If you digitally sign a form template with a trusted certificate, you can set the security level for the form template to Full Trust. Full Trust means that the form can access files and settings on the user's computer or on a different domain. Additionally, you can deploy and update that form template by sending the form template and updated versions of the form template to others by using an e-mail program.
To digitally sign a form with a trusted certificate, follow these steps:
For additional information about how to obtain the latest service pack for Microsoft Office, click the following article number to view the article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/870924/ )How to obtain the latest service pack for Office 2003