BEFORE SAVE

T

tina

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
 
F

Frank Kabel

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?
 
S

Stefan Schier

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