+ Reply to Thread
Results 1 to 10 of 10

Color Picker

  1. #1
    Forum Contributor
    Join Date
    12-09-2006
    Posts
    229

    Color Picker

    I have a form where I want to change the color box on the left hand side see attached image. Now it is a static and I want it dynamic where the user chooses the color. Now it is constant using an image with the color green, red, blue, etc... I want a color picker so user can pick their own colors and when the color is picked the code will pick the color number. is there a way to do that?

    Thanks
    Attached Images Attached Images

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good afternoon walid66

    Wow!!! That colour's a bit loud and offensive isn't it?!?!

    There's some code here by VBAX coder brettdj that should help you out:

    http://vbaexpress.com/kb/getarticle.php?kb_id=224

    I think you have to be a member to view the VBAExpress knowledge base articles, but it's free and there's a lot of free stuff there.

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  3. #3
    Forum Contributor
    Join Date
    12-09-2006
    Posts
    229
    I did download the script but I can't find this library Microsoft Forms 2.0 Object Library. Is there a place where I can download this object library?

    Thanks

  4. #4
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Hi walid66

    You may need to set a reference for it.

    From within the VBE go to Tools > References and look for the bx marked "Microsoft Forms 2.0 Object Library". Tick the little box and click OK.

    HTH

    DominicB

  5. #5
    Forum Contributor
    Join Date
    12-09-2006
    Posts
    229
    I did do that and scolled down but I could not find it in there. Is there way to download it from somewhere and install it?

  6. #6
    Forum Contributor
    Join Date
    12-09-2006
    Posts
    229
    I downloaded the form from Microsoft web site and I pick it. But when I run the script I am getting an error when it gets to this line
    this is the error "Run-time error '1004':
    Method 'VBProject' of object '_workbook' failed"

    Please Login or Register  to view this content.
    I am not sure what the problem is?

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Walid66,

    The VBProject property of the ThisWorkbook references th VBProject object in the VBIDE (Visual Basic Integrated Development Environment). You need to set a reference to this as well. In the References, look for Microsoft Visual Basic for Applications Extensibility library.

    Sincerely,
    Leith Ross

  8. #8
    Forum Contributor
    Join Date
    12-09-2006
    Posts
    229
    Ok now I am getting different error see below

    Please Login or Register  to view this content.
    Thanks

  9. #9
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Hi walid66

    Hmmm, that's 'cos for some reason brettdj is building the class module "on-the-fly" as it were - so you need to tell excel that you are going to allow a VBA routine to create a VBA routine (the class module) of its own. To sort the error go to Tools > Macro > Security, select the Trusted Publishers tab and tick the box marked "Trust access to Visual Basic Project".

    HTH

    DominicB

  10. #10
    Forum Contributor
    Join Date
    12-09-2006
    Posts
    229
    thanks it worked. Now I have to see how I can write the code so I can select the color.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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