Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Hide Expression in Pivot table Using Macro

Hi,

I have a chart where i need to include the expression in Pivot table, but not display the same in the Pivot table. Similarly I have some dimensions also. I hid the dimensions using the below macro. But the Same is not working for Expressions. Please let me know if you have achieved this using macro/other options. The line   objExp(1).ColWidth = 0 is throwing some error.

sub ShowHide

  set var = ActiveDocument.Variables("VDimshow")

  varValue = var.GetContent.String

  set obj = ActiveDocument.GetSheetObject("CH11")

  set objProp = obj.GetProperties

  set objDim = objProp.Dimensions

set objExp = objProp.Expressions

    if varValue = 0 then

  objDim(0).ColWidth = 0

  var.SetContent 0,true

  objDim(1).ColWidth = 0

  var.SetContent 0,true

objExp(1).ColWidth = 0

var.SetContent 0,true

  end if

  obj.SetProperties objProp

    end sub

0 Replies