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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro to set a Bookmark via Button

Hi, I would like to generate the code required to set a bookmark with a Macro by assigning it with an action button.

I have done a similar task with Disable/Enable an expressions from the community.http://community.qlik.com/message/15234#15234

I want to replicate the same task by appplying a bookmark ID.

I though the API for this was:  set myobj = ActiveDocument.SetDocBookmarkId("BM02")

But I get this error.

Wrong number of arguments or invalid property assignment: 'ActiveDocument.SetDocBookmarkId'

3 Replies
m_woolf
Master II
Master II

Look at CreateDocBookmark

Not applicable
Author

Bookmark is created just trying to apply it and undo it with the button.  i.e true/false type of macro once the BM02 is set.

sub ToggleContractors

set myobj = ActiveDocument.SetDocBookmarkId "BM02"

set v = ActiveDocument.GetVariable("vToggleBM") 'first create a variable

Cnt= v.getcontent.String

prop = myobj.GetProperties

if Cnt=0 then

    set expr = prop.Expressions.Item(2).Item(0).Data.ExpressionData

    expr.Enable = true                      'enable Bookmark

    v.setContent "1",true

else

    set expr = prop.Expressions.Item(2).Item(0).Data.ExpressionData

    expr.Enable = false                 'disable Bookmark

    v.setContent "0",true

end if

myobj.SetProperties prop

end sub

m_woolf
Master II
Master II

To apply, try RecallDocBookmark