Solved

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

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
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.
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now