Re: Getting Range of a Comment?

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi Baher,

Line feeds are Chr(11), returns Chr(13) or vbCr.
You'll probably want to replace them with spaces:
Dim st as String
st=cmt.Scope.Text
st=Replace(st,Chr(11)," ")
st=Replace(st,vbCr," ")
Maybe replace any vbTab in cmt.Scope.Text with a space too, if there's the
possibility of tabs there?
st=Replace(st,vbTab," ")
and then clean up double spaces
st=Replace(st," "," ")
s = s & "IP#[" & cmt.Author & cmt.Index & "]" & _
" " & cmt.Range.Text & vbTab & "Text: " & st & vbCr

Greetings,
Klaus


"Baher" <Baher@xxxxxxxxxxxxxxxxxxxxxxxxx> schrieb:
klaus,

would you know how i could take out any linefeeds or returns in the
cmt.Scope.Text?

here is my code now...
Sub DisplayComments()
Dim s As String
Dim cmt As Word.Comment
Dim doc As Word.Document
For Each cmt In ActiveDocument.Comments
s = s & "IP#[" & cmt.Author & cmt.Index & "]" & " " &
cmt.Range.Text
& vbTab & "Text: " & cmt.Scope.Text & vbCr
Next
Set doc = Documents.Add
doc.Range.Text = s
End Sub


"Klaus Linke" wrote:

"Klaus Linke" <info@xxxxxxxxxxxxxxxxxxxx> schrieb:
You can't copy/paste all comments in one go from the reviewing pane,
but
you could from the (old) comments pane:
ActiveDocument.ActiveWindow.View.SplitSpecial=wdPaneComments

BTW, if you copy/paste from that pane, you will likely loose the comment
markers.
But if you take the content into a string variable,
myString=Selection.Text,
the string should contain a Chr(5) for each comment marker.

Klaus





.



Relevant Pages

  • Search pattern
    ... Dim strfile As String ... Dim bAddressFound As Boolean ... Dim strCurrentChar As String ...
    (comp.databases.ms-access)
  • Auto Write Name and Merge across
    ... Dim Sheetname01 As String ... Dim WeekName01 As String ...
    (microsoft.public.excel.misc)
  • Re: multiplatform (pocketPC & desktopPC) (Daniel !!)
    ... Friend Versione As String ... Public Sub GetMyConnectionPalmare() ... Dim errorMessages As String ... Private Function GetDS_Desktop(ByVal SQL As String) As DataSet ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: multiplatform (pocketPC & desktopPC) (Daniel !!)
    ... Friend Versione As String ... Public Sub GetMyConnectionPalmare() ... Dim errorMessages As String ... Private Function GetDS_Desktop(ByVal SQL As String) As DataSet ...
    (microsoft.public.dotnet.framework.compactframework)
  • Help answer these 70-310 questions
    ... One argument is the string ... Dim output As New StringBuilder ... EmployeeLocations. ... You create a strongly named serviced component. ...
    (microsoft.public.cert.exam.mcsd)