Solved

How do I freeze panes in Excel using Delphi and OLE

Posted on 2010-09-01
9
2,078 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: 33583542
0
 

Author Comment

by:s_w_e2
ID: 33583549
I'm not sure how to do the above solutions in Delphi.
0
Independent Software Vendors: 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

Independent Software Vendors: 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!

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

690 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