Solved

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

Posted on 2014-03-10
4
471 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
  • 2
4 Comments
 
LVL 49

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
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.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

810 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