-2

the code I copied is:

With Worksheets(1).Range("e5").AddComment
 .Visible = False
 .Text "reviewed on " & Date
End With

when debugging in 3th line gave me syntax mistake. Well this is MS help place and it's supposed to work. My version Excel is Office365 so supposed to be often actualized on windows 10 64 ... any suggestion? I copied this code from https://learn.microsoft.com/es-es/office/vba/api/excel.comment

Anxon Pués
  • 117
  • 5
  • 3
    Guys I don't think he deserved the down vote since the actual code is a direct copy from the link he provided. I mean sure if your experienced you can see the mistake straight away but if your just learning and the documentations says that... – RCL Jan 08 '19 at 08:45
  • 2
    `Well this is MS help place and it's supposed to work.` Even I used to think that :D Unfortunately it is not true. In this case however the reason is different – Siddharth Rout Jan 08 '19 at 08:47
  • 1
    @SiddharthRout I can see from your answer that you checked the link :). Anyway yes MS was also made by humans and humans make mistakes :). – RCL Jan 08 '19 at 08:50
  • Well as a rookie you sometimes don't know what to look/google for. So really assuming "no research effort" and down-voting here is a bit hard, isn't it? He researched the official docs and posted the shortest code to reproduce the issue telling which error he got. That's more than many other people here did. – Pᴇʜ Jan 08 '19 at 10:06

1 Answers1

4

That webpage is using an incompatible code widget.

Replace & with &.

& is the html code for &

With Worksheets(1).Range("e5").AddComment
    .Visible = False
    .Text "reviewed on " & Date
End With
Siddharth Rout
  • 147,039
  • 17
  • 206
  • 250
  • Rout, thanks for your comprehension and help. I'm a real rookie – Anxon Pués Jan 08 '19 at 08:51
  • Being rookie is not a problem. Not doing research is another. You will only attract downvotes like this :) If I was a rookie then I would do a google search on `&` which leads to [Stackoverflow site](https://stackoverflow.com/questions/9084237/what-is-amp-used-for) – Siddharth Rout Jan 08 '19 at 08:53
  • Sidddarth I undertand you, I start using pc's in 1993 when all was done with dos commands and buy books to understand ... programs in old raw basic and made many tries... now at times I forget that google has this huge power ... thanks a lot – Anxon Pués Jan 08 '19 at 10:30
  • Siddhath Rout - Finlly I tried and arrived to do my idea ... maybe you can gave some advice – Anxon Pués Jan 08 '19 at 22:43