Excel crashes, VBA userform cannot save -
i have userform in excel in user enters information , hits "add stock" button. upon pressing button, information entered spreadsheet , spreadsheet saved "activeworkbook.save".
the problem work computers old , excel has tendency crash. when spreadsheet autorecovered, add stock function no longer works, crashes code 75 error. seems activeworkbook.save doesn't work in case, until user manually hits ctrl-s. boss adamant our users not computer savvy enough manage need somehow check if excel has crashed , if automatically save file before start using it.
how check if we're in autorecovery state, , save (without activeworkbook.save) user can continue using form without issues? many thanks.
i can't find direct way check this, here couple of kludgy options. seems if there 2 states workbook autorecovered workbook can in: last saved user or autosaved. caption reflects state it's in. function check existence of phrase in caption.
public function isinautorecovermode(wb workbook) dim wn window set wn = wb.windows(1) isinautorecovermode = _ wn.caption "*[autosaved]?" or _ wn.caption "*[last saved user]?" end function
i'm not sure if there more states , fail in non-english environments, use care.
when last saved user, workbook.path property file stored. when autosaved, workbook.path property equal application.autorecover.path. well, they're equal on machine. may coincidence, doubt it.
because last saved user path isn't distinctive, can't use determine if you're in autorecover mode. if user open autosaved workbook, don't want save, rather save in right location. might need use both these techniques solution want.
make sure tell boss these work-arounds because you're industrious , inventive, not documented , might fail @ time. @ least, wouldn't use them without understanding they're based on guesses. let know end with.
Comments
Post a Comment