Solved

Trying to understand microsoft com object

Posted on 2004-04-29
6
397 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
[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
  • 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
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 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

Technology Partners: 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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

687 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