ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Saving data (https://www.excelbanter.com/excel-programming/342063-saving-data.html)

bach

Saving data
 

Hi,

I have spreadsheet to which users are adding data via UserForms. I
would like to save the data as the user is entering it and to remove
the 'Do you want to save changes' message box that appears when the
user closes down excel.

Any idears

Regards

Bach


--
bach
------------------------------------------------------------------------
bach's Profile: http://www.excelforum.com/member.php...o&userid=26134
View this thread: http://www.excelforum.com/showthread...hreadid=473685


John[_88_]

Saving data
 
Hi Bach,

Use the .Saved workbook property.

Application.ActiveWorkbook.Save
Application.ActiveWorkbook.Saved = True

Best regards

John

"bach" wrote in message
...

Hi,

I have spreadsheet to which users are adding data via UserForms. I
would like to save the data as the user is entering it and to remove
the 'Do you want to save changes' message box that appears when the
user closes down excel.

Any idears

Regards

Bach


--
bach
------------------------------------------------------------------------
bach's Profile:
http://www.excelforum.com/member.php...o&userid=26134
View this thread: http://www.excelforum.com/showthread...hreadid=473685




bach

Saving data
 

I have included, this code inside a private sub when the user enteres
the data into the spreadsheet i have saved it.

This does not stop the message appearing to save changes when closing
the workbook, this is because of the fact that the save code is inside
a private sub ??


--
bach
------------------------------------------------------------------------
bach's Profile: http://www.excelforum.com/member.php...o&userid=26134
View this thread: http://www.excelforum.com/showthread...hreadid=473685


John[_88_]

Saving data
 
Hello Bach,

No, being in a Private sub shouldn't make any difference.

Are you sure that this part of the code is actually being executed? Maybe
step through it line by line (using F8 key) to check that this is happening.

Another other thing is have you changed the code to reference the correct
Workbook? The code below would be fine if only one workbook is open, but is
it possible the user has two workbooks open? Begin the procedure by setting
a reference to the correct workbook:

Dim myWkb As Workbook

Set myWkb = Application.ActiveWorkbook
'Your code here
myWkb.Save
myWkb.Saved = True

A final possibility is that something else is being changed in between the
workbook Saved property being set to true and the workbook actually closing.
If this is the case then the property will be reset to False and you'll be
asked if you want to save.

Hope that helps.

Best regards

John

Application.ActiveWorkbook.Save
Application.ActiveWorkbook.Saved = True


"bach" wrote in message
...

I have included, this code inside a private sub when the user enteres
the data into the spreadsheet i have saved it.

This does not stop the message appearing to save changes when closing
the workbook, this is because of the fact that the save code is inside
a private sub ??


--
bach
------------------------------------------------------------------------
bach's Profile:
http://www.excelforum.com/member.php...o&userid=26134
View this thread: http://www.excelforum.com/showthread...hreadid=473685





All times are GMT +1. The time now is 02:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com