BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Re: Excel comments for cell

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
Raymundo Perez
Guest





PostPosted: Mon Jun 23, 2003 3:07 pm    Post subject: Re: Excel comments for cell Reply with quote



thank you

"Wilfried Knöll" <willi.knoell (AT) t-online (DOT) de> wrote

Quote:
Hi,

i tried the following sequence and it was ok.
procedure TForm1.SpeedButton1Click(Sender: TObject);

Var
vDoc : Variant ;
xCol,
yRow : Integer ;

begin
vDoc := OleContainer1.OleObject ;
xCol := 1 ;
yRow := 1 ;
Repeat
vDoc.ActiveSheet.Cells[yROW,xCOL].Value := 'VALUE' ;
vDoc.ActiveSheet.Cells[yROW,xCOL].addcomment.text (Format
('%d-----%d',[xCol, yRow])) ;
Inc (xCol) ;
If xCol=10
Then
Begin
xCol := 1 ;
Inc (yRow)
End
Until yRow = 10
end ;

In your sequence " excel.Cells.Item[yROW,xCOL].Value(
AdoQuery1BGItemName.asstring );" is wrong. See may example above.
---
Willi


Raymundo Perez schrieb:

May be I expresed myself wrong but I want to add commentary to a
diferent
cells
This Is The Almost Complete code Of what I am Doing;
And Somehow It's lead me to a error just on the second round

yRow:=1;
Xcol:=1;
AdoQuery1.First;
Repeat
excel.Cells.Item[yROW,xCOL].Value( AdoQuery1BGItemName.asstring );
excel.Cells.Item[yROW,xCOL].addcomment.text(
AdoQuery1BGItemNote.asstring );
Inc(xCol);
If xCol=10
then
Begin
xCol:=1;
Inc(yRow);
End;
AdoQuery1.Next;
Until AdoQuery1.Eof;

"Wilfried Knöll" <willi.knoell (AT) t-online (DOT) de> wrote in message
news:3EF00323.4C34B58C (AT) t-online (DOT) de...
Hi,

you can only add one comment to a cell. The following macro shows the
error
handling :

Sub InsertComment ()
On Error GoTo ErrorHandler
With ActiveCell
.AddComment
.Comment.Visible = True
.Comment.Text Text:="Comment"
End With
Exit Sub

ErrorHandler:
MsgBox "This cell already has a comment !"
End Sub

Raymundo Perez schrieb:

I am trying to add comments to a cell
The first time when This line executed comment is added ok
But When the second time It generate an error.
I presume that I missed something like changing comment ID or
something
like
that

Please help me out

That what I use
excel.Cells.Item[yROW,xCOL].addcomment.text(SomeText);

______________
Raymundo Perez
roskiy

--
Mit freundlichen Grüßen

Willi Knöll

Tel.: 02687 929543






Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.