Solved

VB.net Excel Add-in Cell interior color eg Yellow

Posted on 2013-06-19
2
490 Views
Last Modified: 2013-06-19
Hi

In my Excel Add-in I have a procedure where a color is passed in as a string,
why doesn't the following code work?

Sub oColor(ByVal strColor As String)
        Globals.ThisAddIn.Application.Selection.Interior.color = strColr
End Sub
0
Comment
Question by:murbro
2 Comments
 
LVL 81

Accepted Solution

by:
byundt earned 500 total points
ID: 39260733
Excel is expecting a Long for the .Color property, not a string. You can generate the value of that Long by using the color picker (and then interrogating the color of the active cell) or by using the RGB function.
0
 

Author Closing Comment

by:murbro
ID: 39261630
Thanks
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

785 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