用VS2008自带的开发VSTO开发Office Addin时,LoadBehavior 通常会由3变2。检索了整个网络,几乎找不到答案。其实很简单,这是因为自带的VSTO有问题。安装本VSTO,需先进入控制面板卸载Visual Studio 2005 Tools for office Second Edition Runtime。
Private Sub CommandButton1_Click() Dim addIn As COMAddIn Dim automationObject As Object Set addIn = Application.COMAddIns("ExcelImportData") Set automationObject = addIn.Object automationObject.ImportData End Sub Private Sub CommandButton2_Click()