Solved

VB.net Excel Add-in Color Dialog abd Excel cells

Posted on 2013-06-20
3
532 Views
Last Modified: 2013-06-22
Hi

I have an application where users pick colors from a color dialog. The number of the color
is then stued in a cell of a DataGridView and written to a text file:

Me.DataGridView1.Rows(oRowIndex).Cells(3).Value = Me.ColorDialog1.Color.ToArgb()

These colors are then used to color Excel cells at a later date using

Globals.ThisAddIn.Application.Selection.Interior.color = CInt(strColor)

This works for most colors but sometimes different colors come through:\
For example pink (-65408) from the Color Dialog comes through as purple in Excel.
Similarily brown comes through as Navy. Not sure why this is happening
0
Comment
Question by:murbro
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 250 total points
ID: 39262532
Toargb includes the opacity (alpha channel) information. I suggest you just use the R G and B values (you can use VisualBasic.RGB to store the actual colour number you want)
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 250 total points
ID: 39268708
0
 

Author Closing Comment

by:murbro
ID: 39268963
Thanks very much
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question