Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default closing read-only without save dialog box appearing

I have a macro that logs out all users (except myself). It restores the
user's originals settings when closing. It also closes the workbook if more
than workbook are open, and closes Excel if this is the only workbook open.
It opens as a read-only as it is just the interface for the user and all
other items that are saved are not located in this workbook.

I want to close without the save dialog box appearing, and I've tried a few
things already (checked previous posts without success) but to no avail. Any
help is appreciated. All relevant code should be below.

Sub LogoutAllElse()
Dim Sh As Worksheet
Dim Row As Long
Dim TBar As String
Dim Msg As String
'Resets toolbars to the user's original settings
Row = 1
TBar = Workbooks("I.P.C. (1.0).xls").Sheets("File info").Cells(Row, 1)
Do While TBar < ""
Application.CommandBars(TBar).Visible = True
Row = Row + 1
TBar = Workbooks("I.P.C. (1.0).xls").Sheets("File info").Cells(Row, 1)
Loop
Application.DisplayFormulaBar = True
Application.DisplayStatusBar = True
Application.DisplayScrollBars = True

'Counts open workbooks
Dim i As Integer
Dim wkb As Workbook
For Each wkb In Application.Workbooks
If wkb.Name < "PERSONAL.XLS" Then
i = i + 1
End If
Next wkb
'Closes workbook if more than one open
'Closes Excel if just thisworkbook open
If i 1 Then
Application.DisplayAlerts = False
ThisWorkbook.Close False
Application.DisplayAlerts = True
Else
Application.DisplayAlerts = False
ThisWorkbook.Saved = True
Application.Quit
Application.DisplayAlerts = True
End If
End Sub
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
read-only option not appearing on file menu marnie Excel Discussion (Misc queries) 1 October 16th 07 04:38 PM
read-only option not appearing on file menu marnie Excel Discussion (Misc queries) 2 October 16th 07 03:21 PM
Opening/Closing workbooks without dialog boxes Steve :) Excel Programming 2 September 20th 05 09:37 PM
Dialog box when closing an unsaved spreadsheet Kathy4080 Excel Discussion (Misc queries) 1 January 4th 05 10:28 PM
Stop Dialog box from appearing within macro MrAlMackay Excel Programming 3 August 4th 03 02:16 PM


All times are GMT +1. The time now is 10:30 PM.

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

About Us

"It's about Microsoft Excel"