Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Close workbook without alerts
Hi,
I don't want users of my workbook to have the option of saving changes when closing. I tried: Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Application.DisplayAlerts = False End Sub .. . . but this doesn't work. How can I code my workbook to close with no prompts to the user?? Thanks!! Jeff |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Close workbook without alerts
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.DisplayAlerts = False End Sub "Jeff Wright" wrote: Hi, I don't want users of my workbook to have the option of saving changes when closing. I tried: Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Application.DisplayAlerts = False End Sub .. . . but this doesn't work. How can I code my workbook to close with no prompts to the user?? Thanks!! Jeff |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Close workbook without alerts
-- --- Regards, Norman Microsoft Excel MVP "Jeff Wright" wrote in message ... Hi, I don't want users of my workbook to have the option of saving changes when closing. I tried: Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Application.DisplayAlerts = False End Sub . . . but this doesn't work. How can I code my workbook to close with no prompts to the user?? Thanks!! Jeff |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Close workbook without alerts
Hi Jeff,
Try: '============= Private Sub Workbook_BeforeSave( _ ByVal SaveAsUI As Boolean, _ Cancel As Boolean) Cancel = True MsgBox Prompt:="This workbook cannot be saved" End Sub '--------------- Private Sub Workbook_BeforeClose(Cancel As Boolean) Me.Saved = True End Sub '<<============= --- Regards, Norman "Jeff Wright" wrote in message ... Hi, I don't want users of my workbook to have the option of saving changes when closing. I tried: Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Application.DisplayAlerts = False End Sub . . . but this doesn't work. How can I code my workbook to close with no prompts to the user?? Thanks!! Jeff |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Close workbook without alerts
Norman,
This is great, and does exactly what I want it to do! Thanks, Jeff "Norman Jones" wrote in message ... Hi Jeff, Try: '============= Private Sub Workbook_BeforeSave( _ ByVal SaveAsUI As Boolean, _ Cancel As Boolean) Cancel = True MsgBox Prompt:="This workbook cannot be saved" End Sub '--------------- Private Sub Workbook_BeforeClose(Cancel As Boolean) Me.Saved = True End Sub '<<============= --- Regards, Norman "Jeff Wright" wrote in message ... Hi, I don't want users of my workbook to have the option of saving changes when closing. I tried: Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Application.DisplayAlerts = False End Sub . . . but this doesn't work. How can I code my workbook to close with no prompts to the user?? Thanks!! Jeff |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
alerts for changes in workbook | Excel Discussion (Misc queries) | |||
Help on Workbook close and workbook save events | Excel Programming | |||
Reset alerts when closing workbook? | Excel Programming | |||
Close a the current workbook and load another specified workbook | Excel Programming | |||
Closing a workbook with no alerts | Excel Programming |