FeatureInstall Property Example

This example activates a new instance of Microsoft Excel and checks the value of the FeatureInstall property. If the property is set to msoFeatureInstallNone, the code displays a message box that asks the user whether they want to change the property setting. If the user responds "Yes," the property is set to msoFeatureInstallOnDemand.

Dim ExcelApp As New Excel.Application, _
    Reply As Integer
With ExcelApp
    If .FeatureInstall = msoFeatureInstallNone Then
        Reply = MsgBox("Uninstalled features for " _
            & "this application may " & vbCrLf _
            & "cause a run-time error when called." _
            & vbCrLf & vbCrLf _
            & "Would you like to change this setting" & vbCrLf _
            & "to automatically install missing features?", _
            vbYesNo, "Feature Install Setting")
            If Reply = vbYes Then
                .FeatureInstall = msoFeatureInstallOnDemand
            End If
    End If
End With