help with event

Discussion created by achhibb on Feb 25, 2011
can someone please help me out with the document close event?

Dim pExtMgr As IExtensionManager

Private Sub mxdocument_closedocument()
  ToggleExt "3D Analyst"
End Sub

Sub ToggleExt(strExtension As String)
  Dim pExt As IExtension
  Dim pExtConfig As IExtensionConfig
  On Error GoTo EH:
  Set pExtMgr = Application
  Set pExt = pExtMgr.FindExtension(strExtension)
  Set pExtConfig = pExt
  Select Case pExtConfig.State
        Case esriESEnabled
      pExtConfig.State = esriESDisabled
    Case esriESUnavailable
      MsgBox "3D Analyst is Unavailable in this computer"
  End Select
  Exit Sub
  MsgBox Err.Description
End Sub

must be how i have the closedocument now, it would not run when i close out. i have tried pasting it in "This Document" for Normal.mxt, and "This Document" for Project. also tried as a separate module, to no avail.