Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Passing object id to macro

I have a simple sorting macro like this:

Sub ExpressionSort

Set chart = ActiveDocument.GetSheetObject("chartname")

    prop = chart.GetProperties

    If prop.Dimensions(0).SortCriteria.SortByExpression = 1 Then

        prop.Dimensions(0).SortCriteria.SortByExpression = -1

    Else   

        prop.Dimensions(0).SortCriteria.SortByExpression = 1

    End If

    chart.SetProperties prop

End Sub

I'd like to reuse this for different objects, but I can't seem to pass the object id along through a parameter.  I would expect it to be something like this

Sub ExpressionSort(objectname)

Set chart=ActiveDocument.GetSheetObject(objectname)

But that doesn't work at all. 

10 Replies
Not applicable
Author

Nice - that should do it!

Thanks again for the help Michael.