View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
MT4Now
 
Posts: n/a
Default run-time error '91'-Close Button error

I am also getting this error on several PCs. Unloaded Office 2002 and loaded
Office 2003. When closing a spreadsheet get a MVB error highlighting the
line " If Application.ActiveWindow.WindowNumber = 1 Then"
After closing debugger, Excel closes. Is there a fix for this?

--
MontanaLiving


"ASCO IS Help" wrote:

We are currently receiving the DeBug information below from run-time error:

Sub CloseMacro()
If IntState = "ON" Then
CancelDone = False
If Application.ActiveWindow.WindowNumber = 1 Then
DocIsReadOnly = ActiveWorkbook.ReadOnly
StoredId = GetDocumentId()
If StoredId < "" Then 'End-Retrieve the open document
DocId = StoredId
DocWasSaved = ActiveWorkbook.Saved
If Not (DocWasSaved) Then
ret = GWGetDocInfo(DocId, GW_NAME, DocInfoStr, 255)
If ret < GW_OK Or DocInfoStr = "" Then
DocInfoStr = DocId
End If
MsgStr = ClosePromptStr + DocInfoStr + "'?"
Style = vbYesNoCancel + vbQuestion
ret = MsgBox(MsgStr, Style, "Microsoft Excel")
Select Case ret
Case vbYes
If DocIsReadOnly Then 'create a new profile for
the document
SaveNewDoc
Else
ActiveWorkbook.Save
End If
Case vbNo
ActiveWorkbook.Saved = True
Case vbCancel
CancelDone = True
GoTo NeverMind
End Select
End If
Application.ActiveWindow.Close
ret = GWCloseDoc(StoredId, 0, 0)
NeverMind:
Else 'If there is no DocId, check if the document has a name
If ActiveWorkbook.Path = "" Or DocIsReadOnly Then 'If the
doc is unnamed
SaveNewDoc
Else 'Just close the Named, Non-profiled document.
Application.ActiveWindow.Close
End If
End If
Else 'this is not the first window for the workbook
Application.ActiveWindow.Close
End If
Else ' Integrations are turned on
Application.ActiveWindow.Close
End If
End Sub