Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default Working with Comment objects in VBA

I am writing some code to pick up the comments off my worksheet and dump as a
summary on a new sheet. I am doing this with the text property. However I
have the following questions.

1) Can I remove the Author name from the Text and just reveal the message?

2) Can I determine the date the comment was updated.

3) Can I determine the cell address the comment comes from?

See below....

Sub myComments()

Application.ScreenUpdating = False

MyMarket = "China"
Set cmt = Worksheets(MyMarket).Comments

'Clear old
Sheets("Comments").Range("2:5000").ClearContents

myRow = 2

For Each c In cmt
Sheets("Comments").Range("C" & myRow) = c.Text
myRow = myRow + 1
Next

Application.ScreenUpdating = True

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Working with Comment objects in VBA

Sub myComments()
Dim MyMarket as String, sStr as String
c as Comment, myRow as Long, iloc as Long
Application.ScreenUpdating = False

MyMarket = "China"
Set cmt = Worksheets(MyMarket).Comments

'Clear old
Sheets("Comments").Range("2:5000").ClearContents

myRow = 2

For Each c In cmt
With Sheets("Comments").Range("C" & myRow)
sStr = c.Text
iloc = Instr(sStr,":")
if iloc < 0 then
sStr = Trim(Right(sStr,len(sStr)-iloc))
.Value = sStr
.offset(0,-1).Value = c.parent.Address(0,0)
myRow = myRow + 1
Next

Application.ScreenUpdating = True

End Sub

To the best of my knowledge, comments don't record data on when they were
updated.

--
Regards,
Tom Ogilvy

"Bruce" wrote in message
...
I am writing some code to pick up the comments off my worksheet and dump

as a
summary on a new sheet. I am doing this with the text property. However I
have the following questions.

1) Can I remove the Author name from the Text and just reveal the message?

2) Can I determine the date the comment was updated.

3) Can I determine the cell address the comment comes from?

See below....

Sub myComments()

Application.ScreenUpdating = False

MyMarket = "China"
Set cmt = Worksheets(MyMarket).Comments

'Clear old
Sheets("Comments").Range("2:5000").ClearContents

myRow = 2

For Each c In cmt
Sheets("Comments").Range("C" & myRow) = c.Text
myRow = myRow + 1
Next

Application.ScreenUpdating = True

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Working with Comment objects in VBA


Dim c As Comment
Dim Comment As String

Set c = ActiveCell.Comment

Comment = c.Text

Debug.Print "Question 1: " & Replace(Comment, c.Author & ":"
vbCrLf, "")

Debug.Print "Question 3: " & c.Parent.Addres

--
Nick
-----------------------------------------------------------------------
Nicke's Profile: http://www.excelforum.com/member.php...nfo&userid=293
View this thread: http://www.excelforum.com/showthread.php?threadid=26945

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Working with Comment objects in VBA

I may have missed it. Did you mention this would not work in Excel 97?


--
Regards,
Tom Ogilvy


"Nicke" wrote in message
...

Dim c As Comment
Dim Comment As String

Set c = ActiveCell.Comment

Comment = c.Text

Debug.Print "Question 1: " & Replace(Comment, c.Author & ":" &
vbCrLf, "")

Debug.Print "Question 3: " & c.Parent.Address


--
Nicke
------------------------------------------------------------------------
Nicke's Profile:

http://www.excelforum.com/member.php...fo&userid=2930
View this thread: http://www.excelforum.com/showthread...hreadid=269452



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
right click on objects not working Anthony Excel Discussion (Misc queries) 8 October 5th 05 02:19 PM
a comment plugin & copy paste directly from excel to comment ? fr. RFM Excel Worksheet Functions 0 December 1st 04 11:29 PM
Unable to remove Sheet objects in the Microsoft Excel Objects Adrian[_7_] Excel Programming 1 August 26th 04 10:49 PM
Carriage return in comment not working dumbass Excel Programming 5 June 1st 04 11:11 PM
Working with line OLE objects mbobro[_7_] Excel Programming 1 June 1st 04 10:49 AM


All times are GMT +1. The time now is 08:09 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"