Skip to main content
Announcements
NEW Customer Portal: Initial launch will improve how you submit Support Cases. FIND OUT MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Cambiar propiedad Habilitar de una expresión de PivotTable en una Macro

Hola

me gustaría saber qué propiedad o función debo utilizar para cambiar la propiedad "Habilitar" de una expresión perteneciente a una Pivot Table pero desde un procedimiento de Macro.

Mi objetivo es Habilitar o NO habilitar la expresión en función de una condición y en la versión QV10 no lo puedo hacer directamente (la opción de meter la expresión como dimensión para usar su propiedad condicional no me sirve en este caso)

Me podéis ayudar.

Muchas gracias

1 Solution

Accepted Solutions
alexandros17
Partner - Champion III
Partner - Champion III

this is the macro:

where

vRaw_Wos is the variable to be assigned to a button (to hihe and show the expression)

CHRawData is the object containing the variable

cp.Expressions.Item(0). is the first expression

Sub myMacro
set v = ActiveDocument.GetVariable("vRaw_Wos")
select case v.GetContent.String
case 1
v.SetContent "0",true

set chart = ActiveDocument.GetSheetObject("CHRawData")
set cp = chart.GetProperties
set expr = cp.Expressions.Item(0).Item(0).Data.ExpressionData
expr.Enable = false 
chart.SetProperties cp

case else
v.SetContent "1",true

set chart = ActiveDocument.GetSheetObject("CHRawData")
set cp = chart.GetProperties 
set expr = cp.Expressions.Item(0).Item(0).Data.ExpressionData
expr.Enable = true 
chart.SetProperties cp

end select
end sub 

let me know

View solution in original post

2 Replies
alexandros17
Partner - Champion III
Partner - Champion III

this is the macro:

where

vRaw_Wos is the variable to be assigned to a button (to hihe and show the expression)

CHRawData is the object containing the variable

cp.Expressions.Item(0). is the first expression

Sub myMacro
set v = ActiveDocument.GetVariable("vRaw_Wos")
select case v.GetContent.String
case 1
v.SetContent "0",true

set chart = ActiveDocument.GetSheetObject("CHRawData")
set cp = chart.GetProperties
set expr = cp.Expressions.Item(0).Item(0).Data.ExpressionData
expr.Enable = false 
chart.SetProperties cp

case else
v.SetContent "1",true

set chart = ActiveDocument.GetSheetObject("CHRawData")
set cp = chart.GetProperties 
set expr = cp.Expressions.Item(0).Item(0).Data.ExpressionData
expr.Enable = true 
chart.SetProperties cp

end select
end sub 

let me know

Not applicable
Author

This run perfectly.

Thank you very much