[英]Excel Macro - Run-time error '5' when running in Excel 2010
我的Excel宏是用Excel 2013編寫的,但是當我的同事在Excel 2010中運行它時,會出現以下錯誤:
運行時錯誤“ 5”
我並不是VBA的專家。 為什么會出現此錯誤?
當我運行調試器時,它將指向以下部分:
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Tempo!R1C1:R5000C5", Version:=xlPivotTableVersion15).CreatePivotTable _
TableDestination:="Tempo2!R1C1", TableName:="PivotTable1", DefaultVersion _
:=xlPivotTableVersion15
xlPivotTableVersion15
特定於Excel 2013。
以下是該枚舉的可能值:
Value Version
----------------------- ----------
xlPivotTableVersion2000 Excel 2000
xlPivotTableVersion10 Excel 2002
xlPivotTableVersion11 Excel 2003
xlPivotTableVersion12 Excel 2007
xlPivotTableVersion14 Excel 2010
xlPivotTableVersion15 Excel 2013
嘗試更改宏以改為使用xlPivotTableVersion14
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.