Tag: vb6 migration

这个代码工作VB,但在VB.NET中,例外,为什么?

目标达成:我想改变数据透视表的SourceData。 我想从'C:\[file.xlsx]SheetName'!RangeName 'SheetName'!RangeName为'SheetName'!RangeName 我有以下的实现: For Each table In sheet.PivotTables Dim str = "'" + Split(table.SourceData, "]")(1) table.SourceData = str // Gives Exception here Next table // Exception: Exception from HRESULT: 0x800A03EC 在错误str有值'SheetName'!RangeName (这很好..) 我也得到一个消息框之前的exception: Can not open the source file C:\file.xlsx (这不是很明显,因为它在使用中) 请帮助..这在VB中作为一个macros。