Show All

# RegisterSolution Method (Application Object)

Installs the specified Microsoft Office InfoPath form template.

expression.RegisterSolution(ByVal bstrSolutionURL As String, [ByVal bstrBehavior As String = "overwrite"])

expression Required. An expression that returns a reference to an Application object.

bstrSolutionURL Required String. The string that specifies the Uniform Resource Locator (URL) of the form template. This parameter can be specified as a form definition (.xsf) file or a form template (.xsn) file.

bstrBehavior Optional String. Default value is "overwrite". The string that specifies how the form template is to be installed. The only other valid value for this parameter is "new-only".

## Security Level

3: Can be accessed only by fully trusted forms.

## Remarks

If the form template has already been registered, and "new-only" is specified for the bstrBehavior parameter, the RegisterSolution method will return an error. If "overwrite" is specified, the form template's registration record will be overwritten.

Note This object model member is not supported when the Disable Service Pack features option on the Advanced tab of the Options dialog box in InfoPath is selected or when Microsoft Office 2003 Service Pack 1 or later is not installed. Any form that implements this object model member in its code will generate an error message if it is opened in InfoPath when service pack features are disabled or unavailable.

## Example

In the following Visual Basic for Applications (VBA) example, the RegisterSolution method of the Application object is used to install a form template:

    Public Sub InstallForm()

       Dim objIP As Object

       ' Create a reference to the Application object.
       Set objIP = CreateObject("InfoPath.Application")

       ' Register the InfoPath form template.
       objIP.RegisterSolution ("C:\\My Forms\\MyFormTemplate.xsn")
       MsgBox "The InfoPath form template has been registered."

       Set objIP = Nothing

    End Sub

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp