'http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#//0042000000r8000000
Sub EnableExtension()
Dim pUID As New UID
pUID.Value = "{3C5059FE-9F15-401A-94ED-EED914D73E3E}" 'Spatial Analyst
Dim pExtConfig As IExtensionConfig
Set pExtConfig = Application.FindExtensionByCLSID(pUID)
If Not pExtConfig Is Nothing Then
If (Not pExtConfig.State = esriESUnavailable) Then
pExtConfig.State = esriESEnabled '有効
pExtConfig.State = esriESDisabled '無効
Else
MsgBox "No licenses available"
End If
Else
MsgBox "Extension is not installed"
End If
End Sub