Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VB.net Excel Add-in Get ARGB color of cell

Posted on 2014-03-10
4
Medium Priority
?
513 Views
Last Modified: 2014-03-12
Hi

Im my VB.net Excel Add-in I am trying to get the ARGB color components of a cell
but am getting the error shown in the image


Private Sub oGet_Click(sender As System.Object, e As System.EventArgs) Handles oGet.Click
        Dim X As Drawing.Color
        Dim A As Integer

        X = Globals.ThisAddIn.Application.ActiveCell.Interior.Color

        A = X.A
        MsgBox(A)

    End Sub

1
0
Comment
Question by:Murray Brown
  • 2
4 Comments
 
LVL 53

Expert Comment

by:Rgonzo1971
ID: 39919780
Hi,

pls try

X = System.Drawing.ColorTranslator.FromOle((int) Globals.ThisAddIn.Application.ActiveCell.Interior.Color)

Open in new window

Regards
0
 

Author Comment

by:Murray Brown
ID: 39919856
I get the errors
Error      22      Comma, ')', or a valid expression continuation expected.      C:\Users\murbro\Documents\Visual Studio 2010\Projects\Elements\Elements\TaskPane_WebReport.vb      239      50      Elements
Error      21      Overload resolution failed because no accessible 'Int' accepts this number of arguments.      C:\Users\murbro\Documents\Visual Studio 2010\Projects\Elements\Elements\TaskPane_WebReport.vb      239      45      Elements
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 total points
ID: 39921590
How about following?

X = System.Drawing.ColorTranslator.FromOle(CType(Globals.ThisAddIn.Application.ActiveCell.Interior.Color, Integer))

Open in new window

0
 

Author Closing Comment

by:Murray Brown
ID: 39923671
Worked Perfectly! Thanks very much!
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

972 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