View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Skip[_3_] Skip[_3_] is offline
external usenet poster
 
Posts: 3
Default PivotTable selection

Hi,

I've created a PivotTable using code and I can't seem to
find a way to actually select it after it's done (hence,
also display the PivotTable Field List) other than
selecting a cell within my PivotTable.

Is there a function somewhere that would select the newly
created PivotTable no matter where it's residing on the
sheet?

Thanks, SC

BTW, here's a sample of my code if it helps:

Dim oPivot As PivotTable

With ActiveWorkbook.PivotCaches.Add
(SourceType:=xlExternal)
.Connection = {...}
'CreatePivotTable parameters order: TableDestination,
TableName, ReadData, DefaultVersion
Set oPivot = .CreatePivotTable("[beh_gui.xls]Data!
R3C2", "BEHPivotTable", , xlPivotTableVersion10)
End With
oPivot.AddDataField oPivot.PivotFields("Value"), "Total
Value", xlSum

What should come next? For the moment, I have this:
oPivot.EnableFieldList = True
ActiveWorkbook.Sheets(2).Activate
ActiveWorkbook.Sheets(2).Range("B3").Select