Learn how to a build a cloud-first strategyRegister Now


Unable to set the Color property of the Font class

Posted on 2006-05-23
Medium Priority
Last Modified: 2013-12-03
The below syntax is thowing the error " An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in microsoft.visualbasic.dll.

Additional information: Unable to set the Color property of the Font class.

xl.Cells(loc, c).font.color = RGB(255, 10, 10)----Giving error.

I have already remove and added the excel reference...havent resolved the issue. Pls help
Question by:nyee84

Accepted Solution

manch earned 2000 total points
ID: 16749019
Use the ForeColor Property and the Color Class Constants
(Color class is provided by VS.Net)

Control.ForeColor = Color.Red

so u must write

xl.Cells(loc, c).ForeColor = Color.red

(Or try same case with your font property)

Author Comment

ID: 16770140
How should i declare Color ???

xl.Cells(loc, c).ForeColor = Color.red --- Color shows as undeclared...

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

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