Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
run-time error '91'-Close Button error ASCO IS Help Excel Discussion (Misc queries) 1 May 8th 06 04:25 PM
Close Button Error Allen Geddes Excel Programming 4 November 17th 05 02:54 PM
commandbar at workbook before close - run time error tango Excel Programming 1 October 24th 04 10:42 PM
commandbar at workbook before close - run time error tango Excel Programming 1 October 23rd 04 08:26 AM
Command Button run-time error Dominique Feteau Excel Programming 1 June 29th 04 02:57 AM


All times are GMT +1. The time now is 01:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"