Excel VBA can't open Workbook

后端 未结 7 1679
有刺的猬
有刺的猬 2020-12-11 07:48

First: I\'m using Excel 2007, but the code has to work for Excel 2003 as well.

My problem is the following: I need to access cells in a different workbook, which may

7条回答
  •  爱一瞬间的悲伤
    2020-12-11 08:08

    I would suggest that you open you the new workbook upon opening the calling workbook, in the worbook_open event.

    You then store the new workbook reference in a global variable.

    Then the function called by your cell uses the said global variable instead of trying to open a new workbook. This way you go around the limitations.

    PS : Of course global variable are to be avoided, some sort of container would be better than a direct global variable.

提交回复
热议问题