?
Solved

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

Posted on 2013-06-20
3
Medium Priority
?
542 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:Murray Brown
[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 1000 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 1000 total points
ID: 39268708
0
 

Author Closing Comment

by:Murray Brown
ID: 39268963
Thanks very much
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
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…

762 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