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

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
sonikajain
Partner - Contributor
Partner - Contributor

array handling in Macro vbscript

Hi all,

I want to implement a case where , on clik of one button, I want to display few charts, and change the Y coordinate of hidden charts to 1

then in second button, rest of the charts are displayed, first are hidden, and the positions that were reduced to 1 are bought back(reset), so that thay appear at the desired places.

I need this position changes in order to avoid the extra space that comes on the sheet because of the hidden objects.So, if I change the Y position to 1, the size of the sheet will corespond to only the objects that are visible.

Am using the macro below for capturing the Y position, but am not able to achieve this.

macro **************************************
sub hide1

dim reset_y(50)
dim objID(50)

dim Objects
Objects = ActiveDocument.ActiveSheet.GetSheetObjects()
for i = lbound(Objects) to ubound(Objects)
If Objects(i).GetObjectID()= CH37 Then
pos = Objects(i).GetRect
reset_y(i)=pos.Top
msgbox(reset_y(i))
objID=Objects(i).GetObjectID()
msgbox(objID(i))
end if
next

end sub

Please help me on this macro.

1 Reply
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    Try this

    

sub test

dim reset_y(50)

dim objID(50)

dim Objects

Objects = ActiveDocument.ActiveSheet.GetSheetObjects()

for i = lbound(Objects) to ubound(Objects)

If Objects(i).GetObjectID() = "Document\CH01" Then

pos = Objects(i).GetRect

reset_y(i)=pos.Top

msgbox(reset_y(i))

objID(i)=Objects(i).GetObjectID()

msgbox(objID(i))

'msgbox Objects(i).GetObjectID()

end if

next

end sub

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!