尝试设置Workbook obj变量时,下标超出范围

时间:2018-04-30 16:23:09

标签: excel vba

我无法理解我做错了但是我在第一条SET线上收到错误9(下标超出范围)。

我将模块级公共变量声明为BurdenMaster,拼写正确且一切正常。我是否必须打开工作簿才能设置它?我不知所措,因为上次我运行宏时没有发生这种情况。

谢谢,

'STATIC FILES
theFilePath = ThisWorkbook.Path & "\"
tTemplate = theFilePath & "JE_Upload_Template.xltx"
tBurdenMaster = theFilePath & "Burdens_Master.xlsm"

'For updating the burden amounts in the master
Set BurdenMaster = Workbooks(VBA.Replace(tBurdenMaster, theFilePath, ""))
Set BurdenSched = BurdenMaster.Sheets("BurdenSchedule")

0 个答案:

没有答案