Solved

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

Posted on 2014-03-10
4
482 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

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

737 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