Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro to change dimension label to straght table

Hi all,

I'm trying to use the following script to change the the label of a dimension in a straight table:

Sub Test

set chart = ActiveDocument.GetSheetObject("CH01")

set cp = chart.GetProperties

set dims = cp.Dimensions

dims(0).Title.v = "Test"

chart.SetProperties cp

End Sub

The macro stops working as soon as I add the parentesis to the Dimensions object.

Es.:

set dims = cp.Dimensions          -->     OK!

set dims = cp.Dimensions(0)     -->     KO!

Have you ever experienced something like this?

Thanks in advance.

2 Replies
Gysbert_Wassenaar

Sure. Try without the set. Better yet, don't use a macro to change the dimension label but use a variable as dimension label and change the value of the variable with for example an inputbox object.


talk is cheap, supply exceeds demand
Not applicable
Author

Hi Gysbert, thank for the reply. Finally I understood why I was having this issue:

I was looping incuding system values so the error was generated not because of the Dimension object but because I reached the limit of it.

I solved using:

if not dimName.IsSystem then

cp.Dimensions(j).Title.v = dimName.Name