MS Excel 'Comment' Interface

Steve Holden sholden at holdenweb.com
Wed Oct 31 17:21:43 EST 2001


"L3m Ni$cAt3" <d_blade8 at hotmail.com> wrote ...
>
> Hi all?  I've been piecing together a Python prog to use at work for the
> past few weeks (to speed up some of my time-consuming 'find on the web
then
> plug into Excel" busy-work).  The kind of prog that needs new features
added
> to it every other day or so.  So far it has gone pretty well, except I
have
> seemed to have reached a sticking point.  I would like to be able to enter
> MS Excel "Comments" (you know, right-click, then insert comment; it
differs
> from whatever is actually in the cell).  I can't seem to figure it out.
> I've looked through all the win32all documentation and I think I just
don't
> know what kind of interface to look for.  Dispatch lets me read and write
to
> specific columns and all that, but I just can't seem to find what I need.
> If you know how, could you just show me with a simple example, my actual
> comments are going to come from various sources (net, files, generated by
> the python prog itself) and I figure all that out easily enough, I just
need
> some kind of starting point.  Thanks, I appreciate it.

By the simple expedient of recording a macro I get the following VBA that
you should be able to render into Python fairly easily:

    Range("A1").AddComment
    Range("A1").Comment.Visible = True
    Range("A1").Comment.Text Text:="Steve Holden:" & Chr(10) & "This is a
comment" & Chr(10) & ""
    Range("A1").Select

Hope this helps!

regards
 Steve
--
http://www.holdenweb.com/







More information about the Python-list mailing list