Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello -
I found the _BeforeSave handler but I was wondering if there is a AfterSave handler? I would like to enable some things on my worksheet if a read-only file was successfully saved as something else. How can I catch that? I saw that one of the arguments of _BeforeSave deals with save as and anoter with cancel. The save as makes sense but I somehow thought that I could catch a Cancel Button push with the second argument. I guess that's not the way it works because it is a _BeforeSave handler. Another thing that I cannot seem to get to work is the Saved property. I disable some things on one of my sheets if the file was opened in read-only. I figured that out thanks to some great people here. It calls a function with the Application.OnTime in the _Open() handler. So I disable a few things but now Excel thinks that I changed stuff that needs to be saved! I tried to set ThisWorkbook.Saved = True but it still prompts me to save the file even though I actually have not really changed anything. Thanks so much for you help! Joe |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Cancel is to cancel the action that triggered the Save.
If you made changes to the workbook, then how can you say you didn't. You can use the beforesave to control things in the before save, ' cancel the user's save cancel = False ' perform actions Application.EnableEvents = False sName = lcase(Thisworkbook.FullName) fName = application.GetSaveAsFilename thisworkbook.Save fName if sName < lcase(fName) then ' perform actions End if Application.EnableEvents = True End Sub The above pseudo code may give you some ideas. -- Regards, Tom Ogilvy "Joe HM" wrote in message ups.com... Hello - I found the _BeforeSave handler but I was wondering if there is a AfterSave handler? I would like to enable some things on my worksheet if a read-only file was successfully saved as something else. How can I catch that? I saw that one of the arguments of _BeforeSave deals with save as and anoter with cancel. The save as makes sense but I somehow thought that I could catch a Cancel Button push with the second argument. I guess that's not the way it works because it is a _BeforeSave handler. Another thing that I cannot seem to get to work is the Saved property. I disable some things on one of my sheets if the file was opened in read-only. I figured that out thanks to some great people here. It calls a function with the Application.OnTime in the _Open() handler. So I disable a few things but now Excel thinks that I changed stuff that needs to be saved! I tried to set ThisWorkbook.Saved = True but it still prompts me to save the file even though I actually have not really changed anything. Thanks so much for you help! Joe |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello -
For some reason I have now two SaveAs windows in a row pop up. How can I simply determine whether my file has successfully been saves as? I do a few changes that should not be saved. That's why I tried to clear whatever Excel thought I changed. Everything after that should be considered a change. Is there a way to check for that? Thanks! Joe |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello -
I actually figured it out ... I guess. The function interface that the VB Editor generated did not have the Cancel as byref. I changed that and set it to true to cancel the action. Then I just open up the Save As dialog and check wheter it returned False or not. The only problem I have not fixed yet is how to clear the "changed" buffer or whatever that is. Thanks, Joe |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Joe,
Try setting the Saved property ThisWorkbook.Saved = True -- HTH RP (remove nothere from the email address if mailing direct) "Joe HM" wrote in message ups.com... Hello - I actually figured it out ... I guess. The function interface that the VB Editor generated did not have the Cancel as byref. I changed that and set it to true to cancel the action. Then I just open up the Save As dialog and check wheter it returned False or not. The only problem I have not fixed yet is how to clear the "changed" buffer or whatever that is. Thanks, Joe |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello -
Yeah ... I tried that but it still prompts me even though I have not changed anything! Thanks, Joe |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
if byval is not specified, the default is byref, so explicitly doing that
should change nothing. -- Regards, Tom Ogilvy "Joe HM" wrote in message ups.com... Hello - I actually figured it out ... I guess. The function interface that the VB Editor generated did not have the Cancel as byref. I changed that and set it to true to cancel the action. Then I just open up the Save As dialog and check wheter it returned False or not. The only problem I have not fixed yet is how to clear the "changed" buffer or whatever that is. Thanks, Joe |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello -
Weird ... that I must have done something else wrong! Thanks again, Joe |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I 'catch' a 'delete cells' event | Excel Discussion (Misc queries) | |||
Catch drop event in excel | Excel Programming | |||
How to catch mouse/keyboard event in Office addin | Excel Programming | |||
Catch Update Linked Cells Event | Excel Programming |