Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
read-only option not appearing on file menu | Excel Discussion (Misc queries) | |||
read-only option not appearing on file menu | Excel Discussion (Misc queries) | |||
Opening/Closing workbooks without dialog boxes | Excel Programming | |||
Dialog box when closing an unsaved spreadsheet | Excel Discussion (Misc queries) | |||
Stop Dialog box from appearing within macro | Excel Programming |