Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Highlight\color Cell via VFP Automation 1

Status
Not open for further replies.

mikeisvfp

Programmer
Mar 5, 2011
91
CA
Hello Experts

How do I highlight\color a cell or better yet an entire row?
 
Assuming that loRange is the range of cells that you want to highlight:

Code:
loRange.Interior.ColorIndex = 6

ColorIndex is an integer: 1 = black, 2 = white, 3 = red, .... 6 = yellow, etc.

For the full list of colours, see the VBA Help, or record a macro and pick the colour from the Fill Color button on the toolbar.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
nevermind I think I got it correct me if im wrong, but i tested it and it worked

oSheet.Cells(lnRow,lnCol).Interior.ColorIndex = 6 &&yellow
 
The method I use to find out how to do an Excel Automation that I have not done before always begins without ANY VFP involvement.

I manually do what I want to do in Excel (all by itself) and record the actions as a Macro.

Then I can examine the Macro code and see how Excel is doing it.

AFTER THAT I can then introduce code into VFP Automation of Excel that accomplishes the same thing in the same manner.

I am glad you found your answer.

Good Luck,
JRB-Bldr
 
Thank You Mike

Thank you jrbbldr I will try and record actions as a Macro.
and examine the code produced.

I think I might even consider buying the hentzenwerke book, since i find VFP Automation rather interesting. :)

Thanks
Mike

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top