Author Topic: Getting sys colors  (Read 5627 times)

0 Members and 1 Guest are viewing this topic.

mmulvenna

  • Full Member
  • ***
  • Posts: 91
Getting sys colors
« on: May 22, 2008, 07:27:07 PM »
Here we go with another novice question

I would like to present the user (me) with a color chooser to set the fillforegnd color to what ever they choose.

Any VBA coding samples anyone would care to share?

Thanks
Mike

alias....   Mr. Novice :) :) :) :)

Lars-Erik

  • Sr. Member
  • ****
  • Posts: 278
Re: Getting sys colors
« Reply #1 on: May 23, 2008, 03:06:46 AM »
I don't know how to do this.
What I'd like to know is, why are you doing this using VBA?
Can't the user just use the Visio UI to do this?

- Lars

mmulvenna

  • Full Member
  • ***
  • Posts: 91
Re: Getting sys colors
« Reply #2 on: May 23, 2008, 07:17:40 AM »
Thanks for the pointer. I still need to do it with VBA since I put the color in a user cell and then many shapes reference this cell to get thier fill color. If I can figure out how to call the UI from VBA, will the visio UI allow me to get the color and then put it in a variable and then assign it to a user cell?

The user cell is accessed thru a VBA input form.

Thanks
Mike

Lars-Erik

  • Sr. Member
  • ****
  • Posts: 278
Re: Getting sys colors
« Reply #3 on: May 23, 2008, 07:32:05 AM »
Probably still not what you wanted to hear BUT:
The shape that 'hosts' the fill data, why not have the others inherent the fillcollor from him and have the users set the color of the shape.
I know its a workaround of what your looking for but still.

In case you DONT want the "master" to have a fillcollor you could put the fillcollor to 100% transparent effectivly rendering it useless, but still letting users set it ?

Lets hope someone knows how to do what you want, but in case noone does, it might be worth a shot?

- Lars (just returning from MASSIVE trojan / virus / mallware battle @ 127.0.0.1 )

mmulvenna

  • Full Member
  • ***
  • Posts: 91
Re: Getting sys colors
« Reply #4 on: May 23, 2008, 07:58:19 AM »
Thanks, that is basically what I am doing. I have one input form that asks the users a number of questions so a shape can be bulit based on the answers. One of the questions is "Fill Color". The fill color then is placed in "user.fill_color" of sheet 1. All other shape "fillforegnd" the reference sheet.1!user.Fill_color.

Again, thanks for the suggestions

Mike

mmulvenna

  • Full Member
  • ***
  • Posts: 91
Re: Getting sys colors
« Reply #5 on: May 23, 2008, 06:34:04 PM »
Okay here is a vba form and code that will do the color picking.

I googled it and made a number of changes. I did not write down the site but all the credit goes to that programmer. :-X


1. Open a new visio form
2. OPen the VBA editor
3. Import the form
4 add a "Dim txtrgb as string" to the code
      (this will contain the rgb colors that the user chose. This is what I inserted into my fillforegnd cell)
5. run the form with <F5>
6. press the Show Color Chart button
7. choose your color from the color palette displayed(you can expand it to get even more colors by pressing the "Define Custom Colors"
8. Press the ok button 


Happy coloring :)
Mike
« Last Edit: May 23, 2008, 07:22:00 PM by mmulvenna »