Unable to set the Color property of the Font class

Posted on 2006-05-23
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
    LVL 6

    Accepted Solution

    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 =

    (Or try same case with your font property)

    Author Comment

    How should i declare Color ???

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

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    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…
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    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…

    728 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

    22 Experts available now in Live!

    Get 1:1 Help Now