Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
run-time error '91' - Close Button 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
run-time error '91'-Close Button error | Excel Discussion (Misc queries) | |||
Close Button Error | Excel Programming | |||
commandbar at workbook before close - run time error | Excel Programming | |||
commandbar at workbook before close - run time error | Excel Programming | |||
Command Button run-time error | Excel Programming |