Excel VBA Workbook.ChangeFileAccess

本秂侑毒 提交于 2019-12-06 13:50:05

I think you've hit an interesting foible with the way that Excel changes the read/write state. In order to switch a workbook from read-only to read/write, Excel closes that workbook and opens it again. During this process, your object reference turns into something strangely broken. If you add the line:

  Set w = Workbooks("example.xlsx")

after you ChangeFileAccess to xlReadWrite then it perks up again, but it's not exactly ideal.

Chris

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!