Solved

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

Posted on 2013-06-20
3
516 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
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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

803 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