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

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Can't use "GetPos" function in VB ?

Good day,

I would like to change the size / position of objects with the QlikOCX.

Here is what I tried, because it works in VBScript:


Dim sheetObj As SheetObject
Dim newRect As IRect
Set sheetObj = QlikOCX.ActiveDocument.GetSheetObject("CH01")
Set newRect = sheetObj.GetRect

newRect.Width = 800
newRect.Height = 600

sheetObj.SetRect (newRect)


This return an error in Visual Basic:


Run-time error '430':
Class does not support Automation or does not support expected interface.


Does anybody knows what I have done wrong ?

1 Solution

Accepted Solutions
Not applicable
Author

I did found this:

<pre>
Dim sheetObj As SheetObject
Dim newRect As IRect
Dim sheetVariant As VariantSet sheetObj = QlikOCX.ActiveDocument.GetSheetObject("CH01")
Set sheetVariant = sheetObj
Set newRect = sheetVariant.GetRect
newRect.Width = 800
newRect.Height = 600

sheetObj.SetRect (newRect)


Not really neat, but it does the trick...

View solution in original post

2 Replies
Not applicable
Author

I did found this:

<pre>
Dim sheetObj As SheetObject
Dim newRect As IRect
Dim sheetVariant As VariantSet sheetObj = QlikOCX.ActiveDocument.GetSheetObject("CH01")
Set sheetVariant = sheetObj
Set newRect = sheetVariant.GetRect
newRect.Width = 800
newRect.Height = 600

sheetObj.SetRect (newRect)


Not really neat, but it does the trick...

Not applicable
Author

Ok, I found a proper solution :

Set newRect = sheetObj.GetFrameDef.Rect