ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   BEFORE SAVE (https://www.excelbanter.com/excel-programming/305288-before-save.html)

tina

BEFORE SAVE
 
I would like to private sub like workbook_beforesave to save workbook with new name.
I tried before save writing macro with saveas command in it but this caused excel to perform an illegal operation I think this is due to me asking for circular function i.e before save and saveas in same procedure.
So what I am asking is before operator saves workbook I would like the name of workbook to change either with msgbox prompt or as cell.value is this possible?
hope this is clear
thanks
Tina

Frank Kabel

BEFORE SAVE
 
Hi
in the BeforeSave event try something like

'....
application.enableevents=false
me.saveas "your_new_name.xls"
application.enableevents=true
'...

-----Original Message-----
I would like to private sub like workbook_beforesave to

save workbook with new name.
I tried before save writing macro with saveas command in

it but this caused excel to perform an illegal operation I
think this is due to me asking for circular function i.e
before save and saveas in same procedure.
So what I am asking is before operator saves workbook I

would like the name of workbook to change either with
msgbox prompt or as cell.value is this possible?
hope this is clear
thanks
Tina
.


Stefan Schier

BEFORE SAVE
 
You may also want the CANCEL flag be set to TRUE so that Excel is not
executing a save operation (Cancel = True).

"Frank Kabel" schrieb im Newsbeitrag
...
Hi
in the BeforeSave event try something like

'....
application.enableevents=false
me.saveas "your_new_name.xls"
application.enableevents=true
'...

-----Original Message-----
I would like to private sub like workbook_beforesave to

save workbook with new name.
I tried before save writing macro with saveas command in

it but this caused excel to perform an illegal operation I
think this is due to me asking for circular function i.e
before save and saveas in same procedure.
So what I am asking is before operator saves workbook I

would like the name of workbook to change either with
msgbox prompt or as cell.value is this possible?
hope this is clear
thanks
Tina
.




tina

BEFORE SAVE
 
Thank you with Franks and your answer it worked a treat


"Stefan Schier" wrote:

You may also want the CANCEL flag be set to TRUE so that Excel is not
executing a save operation (Cancel = True).

"Frank Kabel" schrieb im Newsbeitrag
...
Hi
in the BeforeSave event try something like

'....
application.enableevents=false
me.saveas "your_new_name.xls"
application.enableevents=true
'...

-----Original Message-----
I would like to private sub like workbook_beforesave to

save workbook with new name.
I tried before save writing macro with saveas command in

it but this caused excel to perform an illegal operation I
think this is due to me asking for circular function i.e
before save and saveas in same procedure.
So what I am asking is before operator saves workbook I

would like the name of workbook to change either with
msgbox prompt or as cell.value is this possible?
hope this is clear
thanks
Tina
.






All times are GMT +1. The time now is 08:04 AM.

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