Filter highlighter

User avatar
HansV
Administrator
Posts: 78388
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Filter highlighter

Post by HansV »

That's wonderful, Rory! Thank you very much, it looks great!
Best wishes,
Hans

dasadler
5StarLounger
Posts: 889
Joined: 25 Jan 2010, 16:26
Location: Garden Grove, CA 92844 USA

Re: Filter highlighter

Post by dasadler »

How can I configure Excel 2007 such that this filter highlighter add-in is ALWAYS present and available? Even when starting new workbooks & sheets.
Don

User avatar
HansV
Administrator
Posts: 78388
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Filter highlighter

Post by HansV »

Install it as an add-in:

Save the .xla or .xlam to a convenient folder, for example your Addins folder (C:\Users\<username>\AppData\Roaming\Microsoft\AddIns under Window Vista and Windows 7, or C:\Documents and Settings\<username>\Application Data\Microsoft\AddIns under Windows XP). But any folder will do.

In Excel 2007, click the Office button, then Excel options.
Click Add-Ins in the navigation pane on the left hand side.
Select Excel Add-ins from the Manage: dropdown at the bottom of the dialog (this is the default choice), then click Go...
If you see Filter Highlighter in the list of available add-ins, tick its check box.
Otherwise, click Browse..., navigate to the .xla / .xlam, select it and click OK. The add-in should now appear in the list; tick its check box.
Click OK.
The add-in should now be permanently available.
Best wishes,
Hans

dasadler
5StarLounger
Posts: 889
Joined: 25 Jan 2010, 16:26
Location: Garden Grove, CA 92844 USA

Re: Filter highlighter

Post by dasadler »

Great - thank you very much.
Don

gailb
3StarLounger
Posts: 254
Joined: 09 May 2020, 14:00

Re: Filter highlighter

Post by gailb »

I just downloaded this and get an error at the line

Code: Select all

Private Declare Function ChooseColor Lib "comdlg32.dll" Alias "ChooseColorA" (pColorStruct As ColorStruct) As Long
Is this due to I have a 64bit system?

User avatar
HansV
Administrator
Posts: 78388
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Filter highlighter

Post by HansV »

Do you have the 64-bit version of Office?
Best wishes,
Hans

gailb
3StarLounger
Posts: 254
Joined: 09 May 2020, 14:00

Re: Filter highlighter

Post by gailb »

Yes

User avatar
HansV
Administrator
Posts: 78388
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Filter highlighter

Post by HansV »

Change the line

Code: Select all

Private Declare Function ChooseColor Lib "comdlg32.dll" Alias "ChooseColorA" (pColorStruct As ColorStruct) As Long
to

Code: Select all

Private Declare PtrSafe Function ChooseColor Lib "comdlg32.dll" Alias "ChooseColorA" (pColorStruct As ColorStruct) As LongPtr
and the lines

Code: Select all

Private Type ColorStruct
  lStructSize As Long
  hwndOwner As Long
  hInstance As Long
  rgbResult As Long
  lpCustColors As String
  flags As Long
  lCustData As Long
  lpfnHook As Long
  lpTemplateName As String
End Type
to

Code: Select all

Private Type ColorStruct
  lStructSize As LongPtr
  hwndOwner As LongPtr
  hInstance As LongPtr
  rgbResult As LongPtr
  lpCustColors As String
  flags As LongPtr
  lCustData As LongPtr
  lpfnHook As LongPtr
  lpTemplateName As String
End Type
Best wishes,
Hans

gailb
3StarLounger
Posts: 254
Joined: 09 May 2020, 14:00

Re: Filter highlighter

Post by gailb »

Thanks Hans, works great. Also, thanks to rory.

jolas
3StarLounger
Posts: 204
Joined: 02 Feb 2010, 23:58

Re: Filter highlighter

Post by jolas »

Does this work with 64bit version of Excel 2013?

User avatar
HansV
Administrator
Posts: 78388
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Filter highlighter

Post by HansV »

Yes, with the code changes in my previous reply.
Best wishes,
Hans

jolas
3StarLounger
Posts: 204
Joined: 02 Feb 2010, 23:58

Re: Filter highlighter

Post by jolas »

On Excel 2013 64 bit I am getting the following compile error when clicking either choose highlight color or font.The filter heading will have a black cell color as well as black text as I cannot see the cell text. Could you help fix this error.
Thanks.
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78388
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Filter highlighter

Post by HansV »

Does it work if you change

Function ShowColor(...) As Long

to

Function ShowColor(...) As LongPtr
Best wishes,
Hans

jolas
3StarLounger
Posts: 204
Joined: 02 Feb 2010, 23:58

Re: Filter highlighter

Post by jolas »

The compile error moved to this area of the code
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78388
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Filter highlighter

Post by HansV »

Change

Code: Select all

    Dim lngColour As Long
to

Code: Select all

    Dim lngColour As LongPtr
Best wishes,
Hans

jolas
3StarLounger
Posts: 204
Joined: 02 Feb 2010, 23:58

Re: Filter highlighter

Post by jolas »

compileError2.jpg
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78388
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Filter highlighter

Post by HansV »

Does this version work? (By the way, I wonder why it worked for gailb and not for you...)

Hilite Filters.zip
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

jolas
3StarLounger
Posts: 204
Joined: 02 Feb 2010, 23:58

Re: Filter highlighter

Post by jolas »

compileError3.jpg
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78388
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Filter highlighter

Post by HansV »

And now?

Hilite Filters.zip
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

jolas
3StarLounger
Posts: 204
Joined: 02 Feb 2010, 23:58

Re: Filter highlighter

Post by jolas »

It is working now. Your commitment to help is amazing. Thank you for your expertise and patience.