|
Thanks very much for the suggestion. Excellent, that was the solution !
As it was sort of half working, and didnt complain about a missing "self" in an error message which it often does if you get a dot instead of a colon then it never occurred to me to try it.
These 2 examples work now
sheet.Cells(3,
3):AddComment("Test at 3 3\nSecond Line")
sheet:Range("E5"):AddComment("Test hello at E5")
>>From a quick check of the MS Docs it looks like author isnt a parameter for this function, so not sure where i got that from.
Regards Geoff
From: lua-l-bounces@lists.lua.org <lua-l-bounces@lists.lua.org> on behalf of 彭 书呆 <nerditation@outlook.com>
Sent: 06 March 2019 11:55 To: lua-l@lists.lua.org Subject: Re: Luacom Excel Question 在 2019/2/28 19:11, Geoff Smith 写道:
> Hello > > I am writing a script that uses Luacom to create an Excel spreadsheet. > > I am stuck on an annoying problem. I want to write a comment to a cell. I can get the comment red triangle to appear in my spreadsheet and I can set the name of the author, but the comment text body that I am trying to set is always missing. > > sheet.Cells(1, 10).AddComment("Test", "anAuthor") > sheet:Range("E5").AddComment("Test", "anAuthor") > > Both of these lines work in they dont generate an error and both show the author string but both do not show "Test" in the spreadsheet > > Is this a luacom bug or am I doing something wrong here ? Any help from a luacom expert would be appreciated, thanks > > Geoff > > neither an expert on luacom nor on excel, but I suppose you should call ``AddComment`` with a colon instead of a dot. also, the ``Cells`` method probably should also be called using colon. try these lines, see if they worked: ``` sheet:Cells(1, 10):AddComment("Test", "anAuthor") sheet:Range("E5"):AddComment("Test", "anAuthor") ``` |