Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Removal of author from Comments

I currently have a line of code:

MsgBox "You have comment which says " & rCell.Comment.Text

which displays the FULL Comments area.
Can I EXCLUDE the AUTHOR text? If so,
How?

TIA,


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Removal of author from Comments

Only by parsing it out.

the whole think is just a single text string
Sub ae()
Dim rCell As Range
Dim sStr As String
Dim ipos As Long
Set rCell = Range("D6")
sStr = rCell.Comment.Text
ipos = InStr(1, sStr, ":", vbTextCompare)
sStr = Trim(Right(sStr, Len(sStr) - ipos))
MsgBox "You have comment which says " & sStr

End Sub

--
Regards,
Tom Ogilvy




"Jim May" wrote in message
news:X8M5f.2179$AO5.1064@dukeread01...
I currently have a line of code:

MsgBox "You have comment which says " & rCell.Comment.Text

which displays the FULL Comments area.
Can I EXCLUDE the AUTHOR text? If so,
How?

TIA,




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Removal of author from Comments

"Tom Ogilvy" wrote in news:#U0bYyX1FHA.1040
@TK2MSFTNGP14.phx.gbl:

Only by parsing it out.

the whole think is just a single text string
Sub ae()
Dim rCell As Range
Dim sStr As String
Dim ipos As Long
Set rCell = Range("D6")
sStr = rCell.Comment.Text
ipos = InStr(1, sStr, ":", vbTextCompare)
sStr = Trim(Right(sStr, Len(sStr) - ipos))
MsgBox "You have comment which says " & sStr

End Sub




Tom's too quick for me!! I put together a function that does the same
type of thing. The main difference is that it looks for the colon
followed by a new line.

I don't know about others but I delete the author line of almost every
comment I create. A list of potential authors (Application.Username)
might be useful.

Another option might be to look at the font and remove the bold
characters from the beginning.


HTH




Public Function CommentText(c As Range, _
Optional RemoveAuthor As Boolean = False)

Dim CommentLength As Integer
Dim CommentStart As Integer

If c.Comment Is Nothing Then
CommentText = ""
Exit Function
End If

CommentText = c.Comment.Text
CommentLength = Len(CommentText)
CommentStart = InStr(1, CommentText, ":" & Chr(10), vbTextCompare)
CommentStart = CommentStart + IIf(CommentStart 0, 1, 0)

If RemoveAuthor Then _
CommentText = Mid(CommentText, CommentStart, CommentLength)

End Function
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comments Author LSC Excel Discussion (Misc queries) 1 May 8th 09 05:41 PM
Author name edit Dennis Excel Discussion (Misc queries) 4 April 28th 09 12:37 PM
Set author for a comment? Myles Excel Discussion (Misc queries) 5 March 30th 09 07:09 PM
author default for inserting comments jules Excel Discussion (Misc queries) 1 May 19th 07 04:15 AM
Excel comments replace author Not_an_expert Excel Discussion (Misc queries) 2 March 29th 06 08:25 PM


All times are GMT +1. The time now is 08:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"