View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
headly headly is offline
external usenet poster
 
Posts: 45
Default Thanks, works, but why?

That's great but why did it work? I'm writing a course on VBA and my students
will likely ask what is the sort command and why is it necessary? TIA

"Debra Dalgleish" wrote:

Add code to set the sort to manual, and that should prevent the error:

With ActiveSheet.PivotTables("PivotTable1").PivotFields ("Product Name")
.AutoSort xlManual, .SourceName
.PivotItems("Aniseed Syrup").Visible = True
.AutoSort xlAscending, .SourceName
End With


headly wrote:
A recorded macro does this code

With ActiveSheet.PivotTables("PivotTable1").PivotFields ("Product Name")
.PivotItems("Aniseed Syrup").Visible = True
End With

Yet when i try the comand in the immediate window i get run time error 1004
unable to set the visible property of the pivotitem class

Am i missing a reference? As i type pivot code, i don't get any code hints.
is this a late binding problem?



--
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html