Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Setting active tab color

I am trying to set the active tab color.  In the attached document I tried to follow instructions below and seem to not be able to get it work.  Any suggestions on how to set the variable values it discusses below.

First create a variable say vThisTab and set its value to 0.

Second go to Sheet Properties, Triggers, OnActivateSheet, Add Action, External, Set Variable, vThisTab, 1

Third, OnLeaveSheet, Set Variable, vThisTab, 0

Fourth, Sheet Properties, General, Tab Settings, Custom Colors, click on the Tab Color, Base Color, select Calculated and set the following conditional

If($(vThisTab) = 1, RGB(255, 0, 0), RGB(0, 255, 0))

1 Solution

Accepted Solutions
erichshiino
Partner - Master
Partner - Master

Hi,

I created an app with that logic.

Please, check my attachment.

On each tab, check on the general properties -> tab colors

also, check the triggers on all of them .

Hope this helps,

Erich

View solution in original post

7 Replies
Not applicable
Author

Hi

I think it will be hard tii get that method to work, since leaving a tab does not leave any trace.

I solved it by using a macro:

Set activeSheet = ActiveDocument.ActiveSheet

Sub SetTabColor

  'Set old sheet color back
  If (not isnull(activeSheet)) Then
    Set sp=activeSheet.GetProperties
    sp.TabAttr.Mode = 1   ' Sheet colors
    activeSheet.SetProperties sp
  end if

  'Now, save the new sheet
  Set activeSheet = ActiveDocument.ActiveSheet

  'And set the new tab color
  Set sp=activeSheet.GetProperties
  sp.TabAttr.BgColor.PrimaryCol.Col = RGB(255,0,0)
  sp.TabAttr.Mode = 2   ' custom colors
  activeSheet.SetProperties sp

End Sub

And then every tab need to call this makro in the OnActivateSheet trigger.

erichshiino
Partner - Master
Partner - Master

Hi,

I created an app with that logic.

Please, check my attachment.

On each tab, check on the general properties -> tab colors

also, check the triggers on all of them .

Hope this helps,

Erich

Not applicable
Author

Great idea, Erich!

rustyfishbones
Master II
Master II

I created a video on YouTube to show how to do the same

I hope it helps

http://youtu.be/aEAUHt6GzJA

Please share it if it works for you

Not applicable
Author

This works, and does exactly what I wanted it to do. Thanks, erich.shiino!

michaelfentondata
Partner - Contributor III
Partner - Contributor III

I think it is better to use GetActiveSheetId() instead of variables. No need for sheet actions then.

omerfaruk
Creator
Creator

Could you get this work on web view or access point?