ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   BeforeSave (https://www.excelbanter.com/excel-programming/351093-beforesave.html)

steven

BeforeSave
 
I have a file that is used by another person in their directory. When they
save the file I do various tests on values of certain range named cells and
if all the values are ok then that means the file is basically in good order
and I want a copy. The issue is they sometimes mess up a file and don't
realize it until they have mess it up even more, but it I can get a copy
when all test conditions are ok then I will always have the last good copy
handy. I was hoping to do somethin like this:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

If (Here are various tests and if OK) Then
ActiveWorkbook.SaveAs Filename:="F:\Shared\Systems\Book3.xls",
FileFormat:= xlNormal, Password:="mybackup"
Endif

End Sub
And then it would go ahead and save their file in their directory.

Note: I would alwasy like their file saved and only save to my directory if
all the tests are ok. I have tried the above but excel errors totally out
where you get the message. Do you want to send a report to Microsoft?

Is there a way to do what I want?

Thank you for your help.

Steven

Damon Longworth

BeforeSave
 
Have a look at the SaveCopyAs Method in help.

--
Damon Longworth

2006 East Coast Excel User Conference
April 19/21st, 2006
Holiday Inn, Boardwalk
Atlantic City, New Jersey
Early Bird Registration Now Open!!
www.ExcelUserConference.com

2006 UK Excel User Conference
Summer, 2006
London, England



"Steven" wrote in message
...
I have a file that is used by another person in their directory. When they
save the file I do various tests on values of certain range named cells and
if all the values are ok then that means the file is basically in good order
and I want a copy. The issue is they sometimes mess up a file and don't
realize it until they have mess it up even more, but it I can get a copy
when all test conditions are ok then I will always have the last good copy
handy. I was hoping to do somethin like this:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)

If (Here are various tests and if OK) Then
ActiveWorkbook.SaveAs Filename:="F:\Shared\Systems\Book3.xls",
FileFormat:= xlNormal, Password:="mybackup"
Endif

End Sub
And then it would go ahead and save their file in their directory.

Note: I would alwasy like their file saved and only save to my directory if
all the tests are ok. I have tried the above but excel errors totally out
where you get the message. Do you want to send a report to Microsoft?

Is there a way to do what I want?

Thank you for your help.

Steven



steven

BeforeSave
 
And its good.

Thank you very much.


"Damon Longworth" wrote:

Have a look at the SaveCopyAs Method in help.

--
Damon Longworth

2006 East Coast Excel User Conference
April 19/21st, 2006
Holiday Inn, Boardwalk
Atlantic City, New Jersey
Early Bird Registration Now Open!!
www.ExcelUserConference.com

2006 UK Excel User Conference
Summer, 2006
London, England



"Steven" wrote in message
...
I have a file that is used by another person in their directory. When they
save the file I do various tests on values of certain range named cells and
if all the values are ok then that means the file is basically in good order
and I want a copy. The issue is they sometimes mess up a file and don't
realize it until they have mess it up even more, but it I can get a copy
when all test conditions are ok then I will always have the last good copy
handy. I was hoping to do somethin like this:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)

If (Here are various tests and if OK) Then
ActiveWorkbook.SaveAs Filename:="F:\Shared\Systems\Book3.xls",
FileFormat:= xlNormal, Password:="mybackup"
Endif

End Sub
And then it would go ahead and save their file in their directory.

Note: I would alwasy like their file saved and only save to my directory if
all the tests are ok. I have tried the above but excel errors totally out
where you get the message. Do you want to send a report to Microsoft?

Is there a way to do what I want?

Thank you for your help.

Steven





All times are GMT +1. The time now is 09:11 PM.

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