Multiple Users of Same Spreadsheet - random close behavior

SteveInAlabama

Board Regular
Joined
Aug 22, 2002
Messages
94
Thanks in advance for any ideas/help you might have.

I have six identical PC's on the plant floor, all using the same spreadsheet file as a template to send test data to a database. The source spreadsheet is on a read-only directory of a server. They use a short-cut (.LNK) to get the spreadsheet and file.

I have the following code to close everything down if they need to run something else:
Private Sub Workbook_BeforeClose(Cancel) as Boolean
ThisWorkbook.Saved = True
Application.Quit
End Sub

Works fine on the 1st PC set up to access the file. But sometimes on the 2nd, and always on the rest, the msg comes up asking the operator "Do you want to Save: Yes, No, or Cancel".

Are they interacting? I tried ActiveWorkbook instead of ThisWorkbook, but it doesn't act any different. I even tried copying the template spreadsheet file to the local drive of one of the boxes and running it from there, but it still asked about saving. Now I'm really confused...
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
On 2002-09-02 06:47, SteveInAlabama wrote:
Thanks in advance for any ideas/help you might have.

I have six identical PC's on the plant floor, all using the same spreadsheet file as a template to send test data to a database. The source spreadsheet is on a read-only directory of a server. They use a short-cut (.LNK) to get the spreadsheet and file.

I have the following code to close everything down if they need to run something else:
Private Sub Workbook_BeforeClose(Cancel) as Boolean
ThisWorkbook.Saved = True
Application.Quit
End Sub

Works fine on the 1st PC set up to access the file. But sometimes on the 2nd, and always on the rest, the msg comes up asking the operator "Do you want to Save: Yes, No, or Cancel".

Are they interacting? I tried ActiveWorkbook instead of ThisWorkbook, but it doesn't act any different. I even tried copying the template spreadsheet file to the local drive of one of the boxes and running it from there, but it still asked about saving. Now I'm really confused...

Try adding this:
Application.ScreenUpdating = False

prior to:
Application.Quit
 
Upvote 0
Not sure why thats not working, but if you add this line it won't matter

or also try adding this line to the before close event
application.displayalerts = false

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Cancel = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,243
Members
448,555
Latest member
RobertJones1986

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top