Solved

How do I freeze panes in Excel using Delphi and OLE

Posted on 2010-09-01
9
2,049 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
[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
  • 4
  • 3
  • 2
9 Comments
 
LVL 9

Expert Comment

by:javajws
ID: 33583532
0
 
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 500 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help on project with Soap 10 67
how to send memory stream from ics Client To ics server ? 11 204
Controlled Assessment GCSE - desperate help needed 4 118
Delphi Yen format 3 71
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

739 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