Solved

Trying to understand microsoft com object

Posted on 2004-04-29
6
395 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
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!

 
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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
code issue 8 184
Open a URL with Internet Explorer in a new tab (not a new window) 1 147
Wincontrol not (correctly) drawn 15 47
IP without any Dots 1 55
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…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

749 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