level 1
低通滤波器▫
楼主
各位大佬好,我想要功能是从一个excel复制数据到当前的excel文件。折腾了半天还是不知道到底怎么声明变量。错误信息:
System.Runtime.InteropServices.COMException occurred
HResult=0x800A03EC
Message=Exception from HRESULT: 0x800A03EC
Source=<Cannot evaluate the exception source>
StackTrace:
<Cannot evaluate the exception stack trace>
感觉是xlapp和thiswbk定义的不对,或者用法不对。虽然我在模块里定义了变量
Imports Microsoft.Office.Interop.Excel
Imports Microsoft.Office.Tools.Excel
Public Module Module1
Public strFilePath As String
Public xlApp As Excel.Application = Globals.ThisWorkbook.Application
Public thisWbk As Excel.Workbook
Public thisWst As Excel.Worksheet
End Module
可在按钮的脚本里还是出错。
Public Class FrmMain
Private Sub BtnImportIO_Click(sender As Object, e As EventArgs) Handles BtnImportIO.Click
xlApp.ScreenUpdating = False
thisWbk = xlApp.ThisWorkbook ‘这一步出错了
thisWst = thisWbk.Worksheets("IO_List")
xlApp = New Excel.Application With {.Visible = False}
Dim wbkFile As Excel.Workbook = xlApp.Workbooks.Open(strFilePath)‘打开另一个文件
’因为上面就出错了,下面的就不贴了。
End Sub
End Class
2020年12月10日 04点12分
1
System.Runtime.InteropServices.COMException occurred
HResult=0x800A03EC
Message=Exception from HRESULT: 0x800A03EC
Source=<Cannot evaluate the exception source>
StackTrace:
<Cannot evaluate the exception stack trace>
感觉是xlapp和thiswbk定义的不对,或者用法不对。虽然我在模块里定义了变量
Imports Microsoft.Office.Interop.Excel
Imports Microsoft.Office.Tools.Excel
Public Module Module1
Public strFilePath As String
Public xlApp As Excel.Application = Globals.ThisWorkbook.Application
Public thisWbk As Excel.Workbook
Public thisWst As Excel.Worksheet
End Module
可在按钮的脚本里还是出错。
Public Class FrmMain
Private Sub BtnImportIO_Click(sender As Object, e As EventArgs) Handles BtnImportIO.Click
xlApp.ScreenUpdating = False
thisWbk = xlApp.ThisWorkbook ‘这一步出错了
thisWst = thisWbk.Worksheets("IO_List")
xlApp = New Excel.Application With {.Visible = False}
Dim wbkFile As Excel.Workbook = xlApp.Workbooks.Open(strFilePath)‘打开另一个文件
’因为上面就出错了,下面的就不贴了。
End Sub
End Class