Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe this works for you ?
http://j-walk.com/ss/excel/tips/tip78.htm -- Regards, Juan Pablo González "jasonsweeney " wrote in message ... I am trying to run some code rightbefore a workbook closes. The code relates to resetting some passwords hidden in a worksheet. What I want is the code to execute after a person tries to close the workbook. Right now I am using the "BeforeClose" event. The problem here is that the code executes, and then Excel asks the user whether they want to save changes made to the worksheet before closing. If the person says no, then my the effect of my password codes does not take effect. I want to use the Workbook_BeforeClose event, which I think is the last event before the workbook closes, which would allow me to get my desired effect without allowing the user to "veto" the cnages I make to their worksheet right before it closes. However, nothing happens when I use the event. I think this is because I have to "create a new class module and declare an object of type Application with events." (VBA Help for WorkbookBeforeClose Event". I have noever done this before. Any suggestions? --- Message posted from http://www.ExcelForum.com/ |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That may give you some ideas, but it seem to me, if you make changes, you
want them saved. Therefore in the BeforeClose events, turn off Events, save the workbook, then turn events back on. -- Regards, Tom Ogilvy Juan Pablo González wrote in message ... Maybe this works for you ? http://j-walk.com/ss/excel/tips/tip78.htm -- Regards, Juan Pablo González "jasonsweeney " wrote in message ... I am trying to run some code rightbefore a workbook closes. The code relates to resetting some passwords hidden in a worksheet. What I want is the code to execute after a person tries to close the workbook. Right now I am using the "BeforeClose" event. The problem here is that the code executes, and then Excel asks the user whether they want to save changes made to the worksheet before closing. If the person says no, then my the effect of my password codes does not take effect. I want to use the Workbook_BeforeClose event, which I think is the last event before the workbook closes, which would allow me to get my desired effect without allowing the user to "veto" the cnages I make to their worksheet right before it closes. However, nothing happens when I use the event. I think this is because I have to "create a new class module and declare an object of type Application with events." (VBA Help for WorkbookBeforeClose Event". I have noever done this before. Any suggestions? --- Message posted from http://www.ExcelForum.com/ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try placing your code in the Workbook.deactivate event
that should do it. -----Original Message----- Maybe this works for you ? http://j-walk.com/ss/excel/tips/tip78.htm -- Regards, Juan Pablo González "jasonsweeney " <<jasonsweeney.10yqwl@excelforum- nospam.com wrote in message ... I am trying to run some code rightbefore a workbook closes. The code relates to resetting some passwords hidden in a worksheet. What I want is the code to execute after a person tries to close the workbook. Right now I am using the "BeforeClose" event. The problem here is that the code executes, and then Excel asks the user whether they want to save changes made to the worksheet before closing. If the person says no, then my the effect of my password codes does not take effect. I want to use the Workbook_BeforeClose event, which I think is the last event before the workbook closes, which would allow me to get my desired effect without allowing the user to "veto" the cnages I make to their worksheet right before it closes. However, nothing happens when I use the event. I think this is because I have to "create a new class module and declare an object of type Application with events." (VBA Help for WorkbookBeforeClose Event". I have noever done this before. Any suggestions? --- Message posted from http://www.ExcelForum.com/ . |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I was wrong, I tested it and it does not seem to work
there. -----Original Message----- Try placing your code in the Workbook.deactivate event that should do it. -----Original Message----- Maybe this works for you ? http://j-walk.com/ss/excel/tips/tip78.htm -- Regards, Juan Pablo González "jasonsweeney " <<jasonsweeney.10yqwl@excelforum- nospam.com wrote in message ... I am trying to run some code rightbefore a workbook closes. The code relates to resetting some passwords hidden in a worksheet. What I want is the code to execute after a person tries to close the workbook. Right now I am using the "BeforeClose" event. The problem here is that the code executes, and then Excel asks the user whether they want to save changes made to the worksheet before closing. If the person says no, then my the effect of my password codes does not take effect. I want to use the Workbook_BeforeClose event, which I think is the last event before the workbook closes, which would allow me to get my desired effect without allowing the user to "veto" the cnages I make to their worksheet right before it closes. However, nothing happens when I use the event. I think this is because I have to "create a new class module and declare an object of type Application with events." (VBA Help for WorkbookBeforeClose Event". I have noever done this before. Any suggestions? --- Message posted from http://www.ExcelForum.com/ . . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Workbook_BeforeClose | Excel Discussion (Misc queries) | |||
Workbook_BeforeClose Event | Excel Programming | |||
File won't close when "beforeclose" event is used. | Excel Programming | |||
Cancelling the BeforeClose Event | Excel Programming | |||
BeforeClose event - Savings | Excel Programming |