excel - Unshare workbook everyday -
i want unshare excel workbook everyday @ 11:00pm. first use windows task scheduler open file @ 10:59:45pm, , run following code. following code work?
sub unshare() application.displayalerts = false if thisworkbook.multiuserediting thisworkbook.exclusiveaccess application.displayalerts = true thisworkbook.close else application.displayalerts = true thisworkbook.close end sub sub workbook open() application.ontime timevalue("23:00:00"), "unshare" end sub
also, of code located in thisworkbook.
thanks!
try using workbook_open event in private module of workbook object.
private sub workbook_open( ) application.ontime timevalue("23:00:00"), "unshare" end sub
Comments
Post a Comment