The maro that runs in one sheet returns it to a base operating state and clears all the data. This works fine... But The problem is the user may have multiple open windows, and when Excel is exited it tries to close all the windows. If the workbook that contains the beforeclose() sub routine isnt active i get subscript errors. Now it gets better I come in this morning and I am no longer gettting the errors but when I close the sheet it will switch to the workbook containg the subroutine and then you have to exit excel again in order for the workbooks to actually close. How do i fix this so excel will close like normal and not be required to close twice?
This is what i have so far. the before close just call this macro. Mybook and pass code are Dim at the top as strings. Also if these two are declared in this module would the interact with other modules? or other modules in other workbooks?
Windows(mybook).Activate
If access_features = 1 Then
Sheets("features").Activate
Cells(17, 6) = ""
Cells(17, 11) = ""
Sheets("Features").Visible = False
End If
Sheets("welcome").Activate
Cells(31, 9) = ""
ActiveWorkbook.Protect Password:=passcode, Structure:=True, Windows:=False
access_features = 0
ActiveWorkbook.Save
thanks for yalls help
Bookmarks