Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
vijetas42
Specialist
Specialist

Macros For listbox

Hi All,

I want to write macro to change color from list box that is for to change selected color green with orange and deselected color gray to white .can any one tell me how to achieve this.

Thanks!

2 Replies
petter
Partner - Champion III
Partner - Champion III

Have a look at this blog post:

http: / / www . qlikfix . com/2012/05/18/any-colour-as-long-as-its-green/

raajaswin
Creator III
Creator III

Hi vijeta,

Follow these steps to change the default green, white, and gray color schemes:

1. From the Tools menu, select Edit Module (or press Ctrl + M).

2. Enter the following code:

Sub SetColorPrefs()

Dim UserPrefs

set UserPrefs = _

ActiveDocument.GetApplication.GetUserPreferences

' Set the "Selected" Color

UserPrefs.CustomSelBgColor(1).PrimaryCol.Col = _

RGB (0,0,255) ' Blue

UserPrefs.CustomSelFgColor(1).PrimaryCol.Col = _

RGB (255,255,0) ' Yellow

' Set the "Possible" Color

UserPrefs.CustomSelBgColor(2).PrimaryCol.Col = _

RGB (255,255,0) ' Yellow

UserPrefs.CustomSelFgColor(2).PrimaryCol.Col = _

RGB (0,0,0) ' Black

' Set the Excluded Color

UserPrefs.CustomSelBgColor(5).PrimaryCol.Col = _

RGB (200,200,200) ' Light gray

UserPrefs.CustomSelFgColor(5).PrimaryCol.Col = _

RGB (0,0,0) ' Black

' Set the Locked Color

UserPrefs.CustomSelBgColor(0).PrimaryCol.Col = _

RGB (255,0,0) ' Red

UserPrefs.CustomSelFgColor(0).PrimaryCol.Col = _

RGB (0,0,0) ' Black

ActiveDocument.GetApplication.SetUserPreferences _

UserPrefs

end sub

3. Click on the Check button to test for syntax errors. It should display "*** Ready ***".

4. Click on the Test button to execute the code.

5. Click on OK to close the editor.

6. From the Settings menu, open Document Properties (or press Ctrl + Alt + D).

7. Under Color Scheme, select [Custom]. Click on OK.

8. Note that the new color scheme has been applied.

You can change the colours according to you by applying respective colour codes..

Steps by 'Stepen Redmound' in "Qlikview for Developers Cookbook"