• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 548
  • Last Modified:

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

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
Murray Brown
Asked:
Murray Brown
2 Solutions
 
Rory ArchibaldCommented:
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
 
CodeCruiserCommented:
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks very much
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now