Add annotations to the VBA learning notes

Source: Internet
Author: User

' Comment Object
' Represent cell annotations

1 Subannotation Add ()2      with[A1]3        If. Comment is  Nothing  Then4. Addcomment.text"123"5. Comment.visible =True 'Annotations Visible6        End If7     End  with8 End Sub

Add Comment: Range.AddComment.Text

Delete Comment: range.clearcomments

1 Sub Delete annotations () 2  for  each inch Selection 3 If  not  is  Nothing  Then 4     rng.clearcomments5EndIf6Next7  End Sub

Here's the point:

1 Subadd annotations in bulk ()2      for  eachRnginchRange ("a2:a20")3Rng.clearcomments'Whether or not annotations are deleted first, it will be an error to add comments on the original annotations .4         IfRng >= -  ThenRng.AddComment.Text"Excellent"5     Next6 End Sub
1 Subadd annotations to the background map in batches ()2  for  eachRnginchSelection3paths = Thisworkbook.path &"\7pic\"& Rng.value &". PNG" 'Match the pictures in the corresponding picture folder according to the name of the selected area4 rng.clearcomments5 rng.addcomment6Rng.Comment.Shape.Height = -7Rng.Comment.Shape.Width = + 'Set Annotation width8 Rng.Comment.Shape.Fill.UserPicture Paths9 NextTen End Sub

Add annotations to the VBA learning notes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.