Hello!
At work we have a worksheet that is always open. A lot of people are
adding data to the file (on only one computer). But we have a problem;
people are shutting down excel and pressing quot;noquot; on the quot;Do you want to
save changesquot;-notification.
So;
How could I disable the notification, and instead put on a macro like
this;
Private Sub Worksheet_Close()
Worksheet.Save
End Sub
________________________________
Well, I'm no programmer, so it's surely not right, but how could I
easily do what I want?
Thanks.
ØysteinHi
You could enter something like the following in the Workbook module
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.DisplayAlerts = False
If ActiveWorkbook.ReadOnly = True Then
ActiveWorkbook.Close SaveChanges:=False
Exit Sub
Else
ActiveWorkbook.Close SaveChanges:=True
End If
Application.DisplayAlerts = True
End Sub
This will check to see that the file has not been opened as Read Only,
and if not, it will save it before closing regardless of any choices
made by the user.
--
Regards
Roger Govierwrote:
gt; Hello!
gt;
gt; At work we have a worksheet that is always open. A lot of people are
gt; adding data to the file (on only one computer). But we have a problem;
gt; people are shutting down excel and pressing quot;noquot; on the quot;Do you want
gt; to save changesquot;-notification.
gt;
gt; So;
gt; How could I disable the notification, and instead put on a macro like
gt; this;
gt;
gt; Private Sub Worksheet_Close()
gt; Worksheet.Save
gt; End Sub
gt; ________________________________
gt;
gt; Well, I'm no programmer, so it's surely not right, but how could I
gt; easily do what I want?
gt;
gt; Thanks.
gt; Øystein
- Nov 21 Wed 2007 20:40
Auto-save worksheet on close?
close
全站熱搜
留言列表
發表留言