Solved

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

Posted on 2014-03-10
4
487 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:murbro
[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
  • 2
4 Comments
 
LVL 51

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:murbro
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 500 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:murbro
ID: 39923671
Worked Perfectly! Thanks very much!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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 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 will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

729 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