為什麼這篇巨 集 樞紐分析表鄉民發文收入到精華區:因為在巨 集 樞紐分析表這個討論話題中,有許多相關的文章在討論,這篇最有參考價值!作者aming123 (平凡幼稚鬼...)看板Office標題[算表] VBA建立樞紐問題時間Sat...
軟體:EXCEL 2003
版本:NA
請教各位高手,小弟用錄製的方式建立巨集,巨集的內容為建立
樞紐分析表及圖,並設定按下commandbutton時執行此巨集,但
執行時發生錯誤"執行階段錯誤1004,class pivottable的addfiles
方法失敗",請教各位這是那裡出了問題?
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"summary!C1:C13").CreatePivotTable TableDestination:= _
"'[新增Microsoft Excel 工作表.xls]Sheet1'!R10C1", TableName:="樞紐分析表1", _
DefaultVersion:=xlPivotTableVersion10
****************************************************************************
ActiveSheet.PivotTables("樞紐分析表1").AddFields RowFields:="資料", ColumnFields:= _
"PM Parts", PageFields:=Array("Type", "型號")<-------顯示異常的程式
******************************************************************************
With ActiveSheet.PivotTables("樞紐分析表1").PivotFields("PM Parts")
.Orientation = xlDataField
.Position = 1
End With
With ActiveSheet.PivotTables("樞紐分析表1").PivotFields("電容")
.Orientation = xlDataField
.Position = 2
End With
With ActiveSheet.PivotTables("樞紐分析表1").PivotFields("ESC")
.Orientation = xlDataField
.Position = 3
End With
With ActiveSheet.PivotTables("樞紐分析表1").PivotFields("POWER")
.Orientation = xlDataField
.Position = 4
End With
With ActiveSheet.PivotTables("樞紐分析表1").PivotFields("gas")
.Orientation = xlDataField
.Position = 5
End With
With ActiveSheet.PivotTables("樞紐分析表1").PivotFields("pilot wafer iuuse")
.Orientation = xlDataField
.Position = 6
End With
With ActiveSheet.PivotTables("樞紐分析表1").PivotFields("APC")
.Orientation = xlDataField
.Position = 7
End With
ActiveSheet.PivotTables("樞紐分析表1").PivotFields("其它").Orientation = xlDataField
Charts.Add
ActiveChart.Location Where:=xlLocationAsNewSheet
Sheets("Sheet1").Select
End Sub
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 123.204.197.252