Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Adding different bookmark per person at sheet selection

Hi all,

I have built an application that will be used by many people. What I would like to achieve is to have a different bookmark selected at sheet selected for each user (by user I mean Active Directory user). I know this could be achieved by Macro, but could s.o. help me with the code pls.

Best,

Maya

1 Solution

Accepted Solutions
prieper
Master II
Master II

Depends a bit, which fields to be selected, if it is just the user and you have also the user as field in your application then the easiest might be

SUB SelectUser
LET sUser = ActiveDocument.GetApplication.GetProperties.UserName
ActiveDocument.Fields("User").Select sUser
END SUB


The UserName reverts with the domain, which you probably may have to filterout. You may link this macro with the On Activate Sheet-even or the like

HTH
Peter

View solution in original post

2 Replies
prieper
Master II
Master II

Depends a bit, which fields to be selected, if it is just the user and you have also the user as field in your application then the easiest might be

SUB SelectUser
LET sUser = ActiveDocument.GetApplication.GetProperties.UserName
ActiveDocument.Fields("User").Select sUser
END SUB


The UserName reverts with the domain, which you probably may have to filterout. You may link this macro with the On Activate Sheet-even or the like

HTH
Peter

Not applicable
Author

Thank you very much Peter, this was really helpful and was exactly what I needed.

That's the actual code that I used in my application:

SUB ApplyInitialBookmark
ActiveDocument.Fields("User").Select ActiveDocument.GetApplication.GetProperties.UserName
ActiveDocument.Fields("Object").Select REPLACE(ActiveDocument.GetLayout.ActiveSheetId,"Document\","")

SET bookmarkNames = ActiveDocument.Fields("Bookmark").GetPossibleValues

IF bookmarkNames.Count>0 THEN
bookmarkName=bookmarkNames.Item(i).Text
ActiveDocument.RecallDocBookmark bookmarkName
END IF

ActiveDocument.Fields("User").Clear
ActiveDocument.Fields("Object").Clear
END SUB