Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Return Author Comment

That did occur to me later but not before I posted.

Gord

On 20 Mar 2007 16:18:12 -0700, "Pathogen" wrote:

Not necessarily. Sometimes a user will delete the Author name from
the content (text) of the comment. This is why I needed to have the
Comment.Author.

On Mar 20, 6:09 pm, Gord Dibben <gorddibbATshawDOTca wrote:
Comment.Text already returns the comment author.

Why have it twice?

Gord

On Tue, 20 Mar 2007 17:11:55 -0500, Dave Peterson
wrote:

This'll get the author of the workbook--not the author of the comment.


I'll go with Billy's response (now that I know it exists <vbg).


Gord Dibben wrote:


How about this alteration?


Option Explicit
Sub ShowCommentsAllSheets()
'modified from code
'posted by Dave Peterson 2003-05-16
Application.ScreenUpdating = False


Dim commrange As Range
Dim mycell As Range
Dim ws As Worksheet
Dim newwks As Worksheet
Dim i As Long
Dim ColonPos As Long


Set newwks = Worksheets.Add


newwks.Range("A1:F1").Value = _
Array("Sheet", "Address", "Name", "Value", "Comment", "Author")


For Each ws In ActiveWorkbook.Worksheets
On Error Resume Next
Set commrange = ws.Cells.SpecialCells(xlCellTypeComments)
On Error GoTo 0


If commrange Is Nothing Then
'do nothing
Else


i = newwks.Cells(Rows.Count, 1).End(xlUp).Row


For Each mycell In commrange
With newwks
i = i + 1
On Error Resume Next
.Cells(i, 1).Value = ws.Name
.Cells(i, 2).Value = mycell.Address
.Cells(i, 3).Value = mycell.Name.Name
.Cells(i, 4).Value = mycell.Value
.Cells(i, 5).Value = mycell.Comment.Text
.Cells(i, 6).Value = ActiveWorkbook.BuiltinDocumentProperties _
("Author")
End With
Next mycell
End If


Set commrange = Nothing
Next ws


'format cells for no wrapping, remove line break
newwks.Cells.WrapText = False
newwks.Columns("E:E").Replace What:=Chr(10), _
Replacement:=" ", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, _
SearchFormat:=False, ReplaceFormat:=False


Application.ScreenUpdating = True


End Sub


Gord


On Tue, 20 Mar 2007 15:52:49 -0500, Dave Peterson
wrote:


Where can you get the author's name?


If it's the text before the first colon in the comment's text, you could strip
it by looking for the colon and taking everything before that character.


But if you're looking at the status bar and see "Cell A1 commented by Pathogen",
I'm not sure that can be gotten using VBA.


Option Explicit
Sub ShowCommentsAllSheets()
'modified from code
'posted by Dave Peterson 2003-05-16
Application.ScreenUpdating = False


Dim commrange As Range
Dim mycell As Range
Dim ws As Worksheet
Dim newwks As Worksheet
Dim i As Long
Dim ColonPos As Long


Set newwks = Worksheets.Add


newwks.Range("A1:F1").Value = _
Array("Sheet", "Address", "Name", "Value", "Comment", "Author")


For Each ws In ActiveWorkbook.Worksheets
On Error Resume Next
Set commrange = ws.Cells.SpecialCells(xlCellTypeComments)
On Error GoTo 0


If commrange Is Nothing Then
'do nothing
Else


i = newwks.Cells(Rows.Count, 1).End(xlUp).Row


For Each mycell In commrange
With newwks
i = i + 1
On Error Resume Next
.Cells(i, 1).Value = ws.Name
.Cells(i, 2).Value = mycell.Address
.Cells(i, 3).Value = mycell.Name.Name
.Cells(i, 4).Value = mycell.Value
.Cells(i, 5).Value = mycell.Comment.Text
ColonPos = InStr(1, mycell.Comment.Text, ":", vbTextCompare)
If ColonPos 0 Then
.Cells(i, 6).Value = Left(mycell.Comment.Text, ColonPos - 1)
End If
End With
Next mycell
End If


Set commrange = Nothing
Next ws


'format cells for no wrapping, remove line break
newwks.Cells.WrapText = False
newwks.Columns("E:E").Replace What:=Chr(10), _
Replacement:=" ", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, _
SearchFormat:=False, ReplaceFormat:=False


Application.ScreenUpdating = True


End Sub


Pathogen wrote:


I am trying to dump some comment information contained in a
spreadsheet into a new spreadsheet. I found the below macro on the web
but need to include one more piece of information to the output. I
would like to include the Author name but am unsure how to do that.
Can anyone help??? Please see the code below:


Sub ShowCommentsAllSheets()
'modified from code
'posted by Dave Peterson 2003-05-16
Application.ScreenUpdating = False


Dim commrange As Range
Dim mycell As Range
Dim ws As Worksheet
Dim newwks As Worksheet
Dim i As Long


Set newwks = Worksheets.Add


newwks.Range("A1:F1").Value = _
Array("Sheet", "Address", "Name", "Value", "Comment", "Author")


For Each ws In ActiveWorkbook.Worksheets
On Error Resume Next
Set commrange = ws.Cells.SpecialCells(xlCellTypeComments)
On Error GoTo 0


If commrange Is Nothing Then
'do nothing
Else


i = newwks.Cells(Rows.Count, 1).End(xlUp).Row


For Each mycell In commrange
With newwks
i = i + 1
On Error Resume Next
.Cells(i, 1).Value = ws.Name
.Cells(i, 2).Value = mycell.Address
.Cells(i, 3).Value = mycell.Name.Name
.Cells(i, 4).Value = mycell.Value
.Cells(i, 5).Value = mycell.Comment.Text
End With
Next mycell
End If
Set commrange = Nothing
Next ws


'format cells for no wrapping, remove line break
newwks.Cells.WrapText = False
newwks.Columns("E:E").Replace What:=Chr(10), _
Replacement:=" ", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, _
SearchFormat:=False, ReplaceFormat:=False


Application.ScreenUpdating = True


End Sub



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
Set author for a comment? Myles Excel Discussion (Misc queries) 5 March 30th 09 07:09 PM
What are the character codes of a carriage return entered in a comment? John Wirt[_11_] Excel Programming 4 July 29th 05 06:05 AM
a comment plugin & copy paste directly from excel to comment ? fr. RFM Excel Worksheet Functions 0 December 1st 04 11:29 PM
Carriage return in comment not working dumbass Excel Programming 5 June 1st 04 11:11 PM
Changing Author Name in an existing cell's comment Bill[_14_] Excel Programming 2 July 16th 03 10:26 PM


All times are GMT +1. The time now is 12:22 PM.

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

About Us

"It's about Microsoft Excel"