开发者

VSTO Excel: Triggering automatic backups

开发者 https://www.devze.com 2023-03-10 07:24 出处:网络
I have a rather involved Excel add-in that\'s begun exhibiting some bugs after being deployed. This is not unexpected, but one of the bugs is proving really hard to reproduce (and therefore to fix), a

I have a rather involved Excel add-in that's begun exhibiting some bugs after being deployed. This is not unexpected, but one of the bugs is proving really hard to reproduce (and therefore to fix), and it does lock up the application instance, potentially leading to loss of data. So I'd like to trigger an automatic backup right before any function runs that might conceivably crash the application. In time I'll fix all the bugs, of course, but it's proving tricky so I'm looking to use AutoRecover as a stopgap measure in the meantime.

Now, VSTO exposes the AutoRecover object which controls automatic backups of open documents, but all it lets you do is enable/disable AutoRecover, control where backups are stored, and set the backup interval in whole minutes (with a minimum valu开发者_如何学Ce of one minute.)

So is there some other way to trigger a backup event?


Why not just invoke the Workbook.Save function for all sheets where Saved is false? Or maybe SaveCopyAs...

I looked but didn't see anyway to forcible trigger the "backup" process, But, since you can query the AutoRecover object for a path, you could just use SaveCopyAs to do the same thing.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号