There is something I am not understanding and I guess it must be pretty basic.
Can someone please be so kind to explain to me the relationship between Classes and Objects enough so that I can understand what is happening below? Both Location and Name are properties of the PivotTable Class and return strings. Why do the first statements work but the last 4 give the error "Object doesn't support this action (Error 445)"?
?ActiveWorkbook.ActiveSheet.PivotTables.Count
3
?ActiveWorkbook.ActiveSheet.PivotTables(1).Name
PivotTable12
?ActiveWorkbook.ActiveSheet.PivotTables(2).Name
PivotTable3
?ActiveWorkbook.ActiveSheet.PivotTables(3).Name
PivotTable2
?ActiveSheet.PivotTables(1).Location
?ActiveSheet.PivotTables(2).Location
?ActiveSheet.PivotTables(3).Location
?ActiveSheet.PivotTables("PivotTable12").Location
[Location Def][1]
[Immediate Window][2]
[Error][3]
.Locationproperty of PivotTables to work. But instead you can use the.TableRange2property like so:ActiveSheet.PivotTables(1).TableRange2.Addressfor the whole range of the pivottable, orActiveSheet.PivotTables(1).TableRange2.Cells(1).Addressfor just the top left cell.Locationto set, but even then it makes 100% no sense whatsoever. I think this.Locationproperty was added and tested during happy hour and the documentation was written while they were passed out soon afterwards.