Hide a data field on a pivot table

C

cb

We have pivottable templates that we refresh automatically on a nightly
basis using a VB program. We have about 120 different reports. Most
all of the reports have the same data in them so if we want to change
the reports we have to change about 100 pivot tables (8-12 sheets each).
We have been able to reduce the number of templates somewhat by calling
a procedure with different values in a variable. I am trying to reduce
the number of table even more by putting 7 fields in the data area then
programatically hide one of the data items depending on whether the jobe
is a daily or weekly job.

I have an item that when I record a macro to hide the item it gives me
that following code which I can't get to run in the VB program. I keep
getting the error 'Unable to set the Orientation property of the
PivotField class'

With xlWB.ActiveSheet.PivotTables("PivotTable1").PivotFields("Lbs Diff")
.Orientation = xlHidden
End With

"Lbs Diff" is actually the caption I believe. The acutal field is a
field called "MTDLbsDiff" which is a calculated formula.

Does anyone have any idea why the code won't work in my VB program? I
would appreciate any help I can get.

Thank you.

Cat B

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top