申明公共变量
public withevents app as excel.application
在工作簿打开时运行
private sub workbook_open()
set app=excel.application
end sub