ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Workbook_Beforesave getting breached (https://www.excelbanter.com/excel-programming/301210-workbook_beforesave-getting-breached.html)

Hari[_3_]

Workbook_Beforesave getting breached
 
Hi,

I have a workbook in which workbook_beforesave sub is run. The file doesnt
save if there is some internal data inconsistency. ( For example a
particular column is supposed to have only inetegers so if something else is
entered the file will not save).

I notice that once I enter data in it and do a "Save as" instead of save the
beforee save sub still works to my satisfaction.

But, suppose I enter some gibberish data and use the "Send to mail
recepientnt as attachment" then excel saves a temporary file ( having
inconsistent data) and attaches it to my Lotus Notes 5.

I just wanted to understand why this happens.

Also, is there any way may prevent this ( If it doesnt involve
elaborate/abtruse coding I will be greatful to include it as a part of the
existing code.)

Regards,
Hari
India






GJones

Workbook_Beforesave getting breached
 
Hi Hari;

If you change to the BeforeClose method it should overcome
your issue I think. They may close it without saving it
but if the they have made changes to the workbook it will
automatically get interrogated before they get prompted to
do the save or save as.

Thanks,

Greg
-----Original Message-----
Hi,

I have a workbook in which workbook_beforesave sub is

run. The file doesnt
save if there is some internal data inconsistency. ( For

example a
particular column is supposed to have only inetegers so

if something else is
entered the file will not save).

I notice that once I enter data in it and do a "Save as"

instead of save the
beforee save sub still works to my satisfaction.

But, suppose I enter some gibberish data and use

the "Send to mail
recepientnt as attachment" then excel saves a temporary

file ( having
inconsistent data) and attaches it to my Lotus Notes 5.

I just wanted to understand why this happens.

Also, is there any way may prevent this ( If it doesnt

involve
elaborate/abtruse coding I will be greatful to include it

as a part of the
existing code.)

Regards,
Hari
India





.


Hari[_3_]

Workbook_Beforesave getting breached
 
Hi Gjones,

Nopes, Doesnt work.

I opened a new workbook "Book3". Saved it on my desktop. Then I made changes
in it.

When I press the cross button on the righthand corner it prompts me with the
Msg "Pls save the workbook". { Please see my code at the end }.

But if I use Send to Mail receipient as attachment without saving the
changes made then excel sends my file to Lotus Notes.

It seems that along with workbook_beforesave , workbook_beforeclose can also
be breached.
( Thanx a lot to u. I didnt know about before close event. I learned
something new from u.)

Regards,
Hari
India.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
If ActiveWorkbook.Saved = False Then
Cancel = True

MsgBox "Pls save the workbook"
End If

End Sub





"Gjones" wrote in message
...
Hi Hari;

If you change to the BeforeClose method it should overcome
your issue I think. They may close it without saving it
but if the they have made changes to the workbook it will
automatically get interrogated before they get prompted to
do the save or save as.

Thanks,

Greg
-----Original Message-----
Hi,

I have a workbook in which workbook_beforesave sub is

run. The file doesnt
save if there is some internal data inconsistency. ( For

example a
particular column is supposed to have only inetegers so

if something else is
entered the file will not save).

I notice that once I enter data in it and do a "Save as"

instead of save the
beforee save sub still works to my satisfaction.

But, suppose I enter some gibberish data and use

the "Send to mail
recepientnt as attachment" then excel saves a temporary

file ( having
inconsistent data) and attaches it to my Lotus Notes 5.

I just wanted to understand why this happens.

Also, is there any way may prevent this ( If it doesnt

involve
elaborate/abtruse coding I will be greatful to include it

as a part of the
existing code.)

Regards,
Hari
India





.





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

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