?
Solved

How do I freeze panes in Excel using Delphi and OLE

Posted on 2010-09-01
9
Medium Priority
?
2,231 Views
Last Modified: 2012-05-10
I've got most of it (creating a excel sheet from Delphi) working but can't find the correct
 wording for freezing panes.

I'd also like to be able to use validation on cells.

Is there a good resource that I can find this info for myself?
0
Comment
Question by:s_w_e2
  • 4
  • 3
  • 2
9 Comments
 
LVL 9

Expert Comment

by:javajws
ID: 33583542
0
 

Author Comment

by:s_w_e2
ID: 33583549
I'm not sure how to do the above solutions in Delphi.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 13

Expert Comment

by:aflarin
ID: 33583878
>> Is there a good resource that I can find this info for myself?

At first you can import Excel library (Project -> Import Type Library -> Microsoft Excel Object Library)
Then you can look at the imported code and find things like consts, param counts etc

At the second you can use MSDN to find description of all Excel interfaces and objects. For example here is description of FormatConditions.Add method:

http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.formatconditions.add(office.11).aspx
0
 
LVL 13

Accepted Solution

by:
aflarin earned 2000 total points
ID: 33583900
>> I'm not sure how to do the above solutions in Delphi.

procedure TForm1.Button1Click(Sender: TObject);
var
  XLApp: Variant;
begin
  XLApp:=CreateOLEObject('Excel.Application');
  XLApp.Visible:= True;
  XLApp.Range['A2:A2'].Select;
  XLApp.ActiveWindow.FreezePanes:= True;
end;
0
 
LVL 13

Expert Comment

by:aflarin
ID: 33583934
Validation:


procedure TForm1.Button1Click(Sender: TObject);
const
  xlValidateWholeNumber = $00000001;
  xlValidAlertInformation = $00000003;
  xlBetween = $00000001;
var
  XLApp: Variant;
  Validation: Variant;
begin
  XLApp:=CreateOLEObject('Excel.Application');
  XLApp.Visible:= True;
  Validation:= XLApp.Range['A1'].Validation;
  Validation.Add( xlValidateWholeNumber, xlValidAlertInformation, xlBetween, 5, 10 );
  Validation.InputTitle := 'Integers';
  Validation.ErrorTitle := 'Integers';
  Validation.InputMessage := 'Enter an integer from five to ten';
  Validation.ErrorMessage := 'You must enter a number from five to ten';
end;
0
 

Author Closing Comment

by:s_w_e2
ID: 33593353
Is there some source where I can find this info for myself?
0
 

Author Comment

by:s_w_e2
ID: 33593366
Sorry for the comment.  I'd missed your first reply.
0
 

Author Comment

by:s_w_e2
ID: 33593501
In the validation piece I needed to add
Validation.ShowError := True;
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month15 days, 14 hours left to enroll

850 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