我有一个变量(WB)。我将活动工作簿赋值给该变量。
我想检查WB是否设置为活动工作簿,或者它是否仍然为空。如果它存在,我将关闭工作簿。
发布于 2021-02-04 17:04:43
您可以检查对象变量是否按条件设置
if wb is nothing then .... ' not set
if not wb is nothing then .... ' is set你的案例
if not wb is nothing then
if wb.name = thisworkbook.name then wb.close
end if 或者在一行中
if not wb is nothing then if wb.name = thisworkbook.name then wb.closehttps://stackoverflow.com/questions/66042168
复制相似问题