Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Experts,
I have a question for macro.
My customer is developing a macro like the followings.
sub sortingEquipTrendChart(equips)
chartX = 639
chartY = 128
orignX = 0
orignY = chartY
flg = 0
objs = ActiveDocument.ActiveSheet.GetSheetObjects
for i=lbound(objs) to ubound(objs)
if objs(i).GetObjectType = 12 then .
dimen = "=if(EQ_ID='" & equips(flg) & "',EQ_ID)"
objs(i).RemoveDimension 0
objs(i).RemoveDimension 0
objs(i).AddDimension(dimen) --> It doesn't work.
objs(i).AddDimension("STS2_SEQ") --> OK, It works fine.
set pos = objs(i).GetRect
if flg<>0 then
orignY = orignY + (pos.Height - 1)
end if
pos.Top = orignY
objs(i).SetRect pos
set pos = nothing
flg = flg + 1
end if
next
end sub
But he want to know it is possible to use 'addDimension' with a parameter including expression like "=if(EQ_ID='" & equips(flg) & "',EQ_ID)".
Is it possible ?
Need your recommendation.
Thanks ,
WanKi,
Can you post an example where I try to test your code?
Thanks
Luca Jonathan Panetta
I asked for a sample to my customer.
If I get the one , yes I will post it.
Thank you,
WanKi,
Marcus,
I tried to do that, but didn't work.
The equips() is the variable that is declared as an array.
So I printed the value of 'dimen' ( dimen = "=if(EQ_ID='" & equips(flg) & "',EQ_ID)").
The result is the following. Maybe it's ok.
But the statement, objs(i).AddDimension(dimen), it doesn't work.
Regards,
WanKi,
You need it wrapped in double-quotes otherwise it would all content after the first single-quote interpret as comment.
- Marcus
Hello Wanki,
yes is possible to use a variable to set you dimension.
Look this post http://community.qlik.com/message/30950#30950
The correct SUB is takeII()
Best regards
Luca Jonathan Panetta
Luca Jonathan Panetta !!
WoW !! ^^
Thank you very much for your help.
WanKi,