Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

What is the VBA code in Excel to click on a TextObject in QlikView?

Hi All,

I am writing a set of VBA codes to QC my QlikView tool and in the process of doing so I am stuck at a point which is: VBA code to click on TextObject.

I tried two options:

1. QVDoc.GetSheetObject("TXT1").Press

2. QVDoc.GetSheetObject("TXT1").Activate

but both are not working.

Regards

Sagar Gupta

2 Replies
Gysbert_Wassenaar

It's not possible. The com api doesn't have an interface for click events of sheet objects except for the button.


talk is cheap, supply exceeds demand
Not applicable
Author

I tried something where we can create a button which has all actions for that text object, then press that button and then delete it. This gives the same functionality.

Function TextObjClick(tx As String)

Dim newbutton

Dim prop

Dim TextActions

Dim i

Dim ButtonActions

Set newbutton = QVDoc.ActiveSheet.CreateButton

Set prop = newbutton.getproperties

prop.Text.v = QVDoc.GetSheetObject(tx).GetText

Set ButtonActions = prop.ActionItems

Set TextActions = QVDoc.GetSheetObject("TX01").getproperties.Layout.ActionItems

Dim actionparam

Dim j

     For i = 0 To TextActions.Count - 1

          ButtonActions.Add

          ButtonActions.Item(i).Type = TextActions.Item(i).Type

          Set actionparam = ButtonActions.Item(i).Parameters

                    For j = 0 To TextActions.Item(i).Parameters.Count - 1

                           actionparam.Add

                           actionparam.Item(j).v = TextActions.Item(i).Parameters.Item(j).v

                  Next

          Next

newbutton.SetProperties prop

newbutton.press

newbutton.Close

End Function