?
Solved

How do I set conditional formatting in Excel from a Delphi program using OLE

Posted on 2010-08-31
2
Medium Priority
?
1,124 Views
Last Modified: 2012-05-10
I've used
oWB := oXL.Workbooks.add;
oSheet := oWB.activesheet;

This bit works and I can produce an excel sheet but can't get the conditional formatting to work

oSheet.Range['C7:C7'].FormatConditions.add(    ,      ,    ,    )

is the part where I am having trouble.  What do I enter to get a condition of greater than 1
0
Comment
Question by:s_w_e2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 13

Accepted Solution

by:
aflarin earned 2000 total points
ID: 33573958
procedure TForm1.Button2Click(Sender: TObject);
const
  xlCellValue = $00000001;
const
  xlGreater = $00000005;
begin
  WorkSheet.Cells[1,1].FormatConditions.Add(xlCellValue,xlGreater,1);
  WorkSheet.Cells[1,1].FormatConditions[1].Interior.ColorIndex := 3;
end;
0
 

Author Closing Comment

by:s_w_e2
ID: 33582085
Thanks for the solution.  It was great.
Is there a place I can get the format for this - my original try had 4 parameters - yours had only 3  (I've figured that you need 4 if you use xlBetween  (I've got a list of numbers for these).

Can you also give me the format for validation of a cell?
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

777 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