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
Solved

Trying to understand microsoft com object

Posted on 2004-04-29
6
392 Views
Last Modified: 2010-04-05
Im currently trying to work out how I can translate what I read in the excel com object in VBA and workout how to call from excel

I can currently open a new workbook and write data to it fine, but now Im trying to work out how to format cells.
For example, a simple underline for a cell, I read in the com object the line
ActiveCell.Font.Underline = xlUnderlineStyleSingle
I tried doing oSheet.Cells[1,1].Font.Underline := xlUnderlineStyleSingle;
where oSheet is my active sheet, and obviously delphi didnt understand xlUnderlineStyleSingle
Does anyone have a place on the web I might be able to find direct translations,
or have a quick-fire method for me to understand
0
Comment
Question by:mikelittlewood
  • 2
  • 2
  • 2
6 Comments
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 10947642
0
 
LVL 12

Assisted Solution

by:Ivanov_G
Ivanov_G earned 50 total points
ID: 10947662

   also Project / Import Type Library
   select Microsoft Excel 10
   Create Unit

   check if you have

         C:\Program Files\Borland\Delphi7\Ocx\Servers\excel97.pas
0
 
LVL 22

Accepted Solution

by:
Ferruccio Accalai earned 50 total points
ID: 10947953
i don't remember where i've found these units for word and excel constants translations for Delphi....BTW i use them succesfull....

unit ExcelConst;

interface

Const
xlCenter=-4108;
xlLeft=-4131;
xlRight=-4152;
xlDistributed=-4117;
xlJustify=-4130;
xlNone=-4142;
{HorizontalAlignment}
xlHAlignCenter=-4108;
xlHAlignDistributed=-4117;
xlHAlignJustify=-4130;
xlHAlignLeft=-4131;
xlHAlignRight=-4152;
{In addition, for the Range or Style object}
xlHAlignCenterAcrossSelection=7;
xlHAlignFill=5;
xlHAlignGeneral=1;

{VerticalAlignment}
xlVAlignBottom=-4107;
xlVAlignCenter=-4108;
xlVAlignDistributed=-4117;
xlVAlignJustify=-4130;
xlVAlignTop=-4160;

{Borders}
xlInsideHorizontal=12;
xlInsideVertical=11;
xlDiagonalDown=5;
xlDiagonalUp=6;
xlEdgeBottom=9;
xlEdgeLeft=7;
xlEdgeRight=10;
xlEdgeTop=8;

{LineStyle}
xlContinuous=1;
xlDash=-4115;
xlDashDot=4;
xlDashDotDot=5;
xlDot=-4118;
xlDouble=-4119;
xlSlantDashDot=13;
xlLineStyleNone=-4142;

{Weight}
xlHairline=1;
xlThin=2;
xlMedium=-4138;
xlThick=4;

{ColorIndex}
xlColorIndexAutomatic=-4105;
xlColorIndexNone=-4142;

{Background}
xlBackgroundAutomatic=-4105;
xlBackgroundOpaque=3;
xlBackgroundTransparent=2;

{Underline}
xlUnderlineStyleNone=-4142;
xlUnderlineStyleSingle=2;
xlUnderlineStyleDouble=-4119;
xlUnderlineStyleSingleAccounting=4;
xlUnderlineStyleDoubleAccounting=5;

implementation

end.

unit WordConst;

interface

Const
{----MoveRight(Unit, Count, Extend)}
{Unit}
wdCharacter=1;
wdWord=2;
wdSentence=3;
wdCell=12;
wdAdjustNone=0;
wdOrientPortrait=0;
wdOrientLandScape=1;
wdAlignParagraphCenter=1;
wdAlignParagraphLeft=0;
wdAlignParagraphRight=2;
{Extend}
wdMove=0;
wdExtend=1;
wdBorderHorizontal=-6;
wdBorderVertical=-5;
wdLineStyleNone=0;
wdLine=5;
implementation

end.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 15

Author Comment

by:mikelittlewood
ID: 10950547
Excellent

Combining Ivanov_G
   also Project / Import Type Library
   select Microsoft Excel 10
   Create Unit

and data from Ferruccio68,
I can see where Ferruccio68 got his numbers from (converting the hex value in the excel com object file to decimal)

I havent imported the file Ivanov_G and set it in my uses clause as Im not doing too much, so Im just using the decimal numbers.

Thanks to both, I am spliting the points for the 2 of you.
0
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 10950650
Glad to have helped you :)

F68 ;-)
0
 
LVL 15

Author Comment

by:mikelittlewood
ID: 10957797
I think the hard part for me is that I havent done much COM before.
Trying to work out what calls I need to make from delphi to the com objects is a little difficult.
Not sure if there is an easy way or not.

For example, took me a while just to work out how to make a cell bold (lol)
And that was only because I stumbled on an example.
sheet.cell.font.fontstyle := bold;
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

809 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