因此,我“继承”了处理我们在部门中运行的宏的工作,考虑到我对VBA的垃圾处理,我一直在很好地维护它们并整理收到的混乱情况,但是从今天起,我遇到了一个麻烦,因为它不在我从未更改过的代码部分中,这给我带来了麻烦。
我拥有我们使用的文件的主版本,并将其保存为模板供其他人使用(这样他们就不会弄乱我的东西),但是当我今天来尝试打开文件时,我立即在我的“ Set”系列的第一行获得了RTE 438。正如我所提到的,从周五(正常运行)起,此代码没有任何变化。关于可以编辑以摆脱此问题的任何建议?
屏幕如下:
运行调试时关联的代码是:
Public Function InitializeLists()
Dim wsData As Worksheet
Set wsData = ThisWorkbook.Worksheets("Data")
Dim yearList As MSForms.ListBox
Dim cboProv As MSForms.ComboBox
Dim cboDoB As MSForms.ComboBox
Dim cboSpaces As MSForms.ComboBox
Dim cbo6097 As MSForms.ComboBox
Dim cboSelectType As MSForms.ComboBox
Dim cboMinimize As MSForms.ComboBox
Set yearList = ThisWorkbook.Worksheets("Data").ListBox1 'Error appears on this line
Set cboProv = ThisWorkbook.Worksheets("Data").ComboBox2
Set cboDoB = ThisWorkbook.Worksheets("Data").ComboBox2
Set cboSpaces = ThisWorkbook.Worksheets("Data").ComboBox3
Set cbo6097 = ThisWorkbook.Worksheets("Data").ComboBox4
Set cboSelectType = ThisWorkbook.Worksheets("Data").ComboBox5
Set cboMinimize = ThisWorkbook.Worksheets("Data").ComboBox6
任何帮助都需要事先感谢。