Solved

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

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

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

759 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now