![]() |
After SaveAs events - are there any?
Hi
The very last thing I need for my project (that is until I find other needs:-) I have set up a means of keeping backups based on various criteria - all this works well. However, I now need to find the current ActiveBook.FullName on exit from the SaveAs dialog as the name has changed to match the Saved As filename. I can't seem to find any event that fires after the SaveAs. I can't use the BeforeSave as the name hasn't changed at that time, and obviously I can't call any sub from within the BeforeSave sub as the Save hasn't happened yet. Any ideas or solutions? regards, -- Les Hay, Livingston. Scotland |
After SaveAs events - are there any?
Hi Les,
Try this: Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Dim vFilename If SaveAsUI Then Cancel = False vFilename = Application.GetSaveAsFilename("*.xls", "Excel files(*.XLS),*.xls") If vFilename = False Then Exit Sub 'At this time you have the file name to do what you want.before save as Application.EnableEvents = False ThisWorkbook.SaveAs vFilename Application.EnableEvents = True End If End Sub HTH --- Orlando Magalhães Filho (So that you get best and rapid solution and all may benefit from the discussion, please reply within the newsgroup, not in email) "Les" escreveu na mensagem ... Hi The very last thing I need for my project (that is until I find other needs:-) I have set up a means of keeping backups based on various criteria - all this works well. However, I now need to find the current ActiveBook.FullName on exit from the SaveAs dialog as the name has changed to match the Saved As filename. I can't seem to find any event that fires after the SaveAs. I can't use the BeforeSave as the name hasn't changed at that time, and obviously I can't call any sub from within the BeforeSave sub as the Save hasn't happened yet. Any ideas or solutions? regards, -- Les Hay, Livingston. Scotland |
After SaveAs events - are there any?
Hi Orlando
You have solved my problem, and, when I read your reply, I realised exactly what it was and that I should have found it by myself. I had somehow reached a blank - just kept looking everywhere except the obvious. Thanks very much. regards -- Les Hay, Livingston. Scotland "Orlando Magalhães Filho" wrote in message ... Hi Les, Try this: Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Dim vFilename If SaveAsUI Then Cancel = False vFilename = Application.GetSaveAsFilename("*.xls", "Excel files(*.XLS),*.xls") If vFilename = False Then Exit Sub 'At this time you have the file name to do what you want.before save as Application.EnableEvents = False ThisWorkbook.SaveAs vFilename Application.EnableEvents = True End If End Sub HTH --- Orlando Magalhães Filho (So that you get best and rapid solution and all may benefit from the discussion, please reply within the newsgroup, not in email) "Les" escreveu na mensagem ... Hi The very last thing I need for my project (that is until I find other needs:-) I have set up a means of keeping backups based on various criteria - all this works well. However, I now need to find the current ActiveBook.FullName on exit from the SaveAs dialog as the name has changed to match the Saved As filename. I can't seem to find any event that fires after the SaveAs. I can't use the BeforeSave as the name hasn't changed at that time, and obviously I can't call any sub from within the BeforeSave sub as the Save hasn't happened yet. Any ideas or solutions? regards, -- Les Hay, Livingston. Scotland |
All times are GMT +1. The time now is 06:02 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com