+ Reply to Thread
Results 1 to 3 of 3

How to show Theme color window with Excel VBA?

  1. #1
    Registered User
    Join Date
    03-25-2012
    Location
    Dhaka, Bangladesh
    MS-Off Ver
    Excel 2007
    Posts
    12

    How to show Theme color window with Excel VBA?

    In VBA, I can show color window as below. After selecting a color from this color window, I can use the selected color for changing Font color, Cell background color, etc.

    Please Login or Register  to view this content.
    Capture.PNG

    But I want to show below window. Please kindly advise what will be the code and how I can implement in VBA. Let's say I want to color a font with selected color.

    Untitled.png

  2. #2
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,206

    Re: How to show Theme color window with Excel VBA?

    By default, the ExecuteMso method is used to "press" the selected icon, e.g.
    Please Login or Register  to view this content.
    But in the case of the gallery, the above code will give the font in the active cell the color last selected in the gallery, without showing the color picker.
    Another method to "press" an icon is to use a keyboard shortcut. When you press the left Alt key, you will get prompts as to what keys you need to press sequentially to trigger the icon. In the Polish language version, to display the color picker for fonts, I will use Left Alt, G, F, 1. To color the background of the cells, I will use Left Alt, G, H, 1. In the code below, adjust the key sequence according to your language version.
    Please Login or Register  to view this content.
    If you will be running the macro with a button, you can assign the TestKbd macro to it. If you will be running from the Macro window (keyboard shortcut Alt+F8), then you must call the Test macro. If you will be running this macro with a keyboard shortcut, then the Test macro should at least have this form:
    Please Login or Register  to view this content.
    and all the keys of the applied shortcut must be released before one second expires.

    In theory, you could use the SendKeys method instead of winAPi keybd_event. However, the use of SendKeys on many computers causes a problem (most often the numeric keypad "freaks out") so for many years, however, I have recommended winAPI, which is more stable in execution.

    Artik

  3. #3
    Registered User
    Join Date
    03-25-2012
    Location
    Dhaka, Bangladesh
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: How to show Theme color window with Excel VBA?

    In my VBA userform, I have command button. I want when user will click in that command button, then below color picker will appear. And when user will select a color then a label in that userform will change the background color.
    Attachment 816307

    With your below code is not showing above color window, even showing nothing. Sorry may be i could not apply in right way. Please help.
    Please Login or Register  to view this content.
    Currently I am using below code.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Changing cells to be the theme color?
    By DarkSoul in forum Excel - New Users/Basics
    Replies: 7
    Last Post: 10-20-2020, 01:33 PM
  2. [SOLVED] How to change Theme Color from Accent to ColorIndex
    By Stealth2017 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-01-2018, 02:01 AM
  3. VBA workaround to set workbook color theme
    By sintek in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-26-2018, 08:51 AM
  4. Replies: 1
    Last Post: 12-07-2016, 08:03 PM
  5. Any way to apply a color theme by changing the color of one cell ?
    By KomicJ in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-02-2016, 01:11 PM
  6. Changing color theme
    By Eashworth in forum Excel General
    Replies: 5
    Last Post: 08-24-2015, 10:59 PM
  7. Replies: 0
    Last Post: 11-30-2009, 01:02 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1