i have found macros older versions of word extract comments document , create table in new document 4 columns.
column 1: page number of comment
column 2: commented text
column 3: actual comment
column 4: person commenting
have pasted macros below, can't work in word 2011. colored problematic text in red (or @ least part of problem). out there know how work? or maybe have different code altogether? haven't slightest. ahead of time help.
attribute vb_name = "bascomments_extract"
option explicit
public sub extractcommentstonewdoc()
'macro created 2007 lene fredborg, doctools - www.thedoctools.com
'the macro creates new document
'and extracts comments active document
'incl. metadata
'minor adjustments made styles used
'you may need change style settings , table layout fit needs
'=========================
dim odoc document
dim onewdoc document
dim otable table
dim ncount long
dim n long
dim title string
title = "extract comments new document"
set odoc = activedocument
ncount = activedocument.comments.count
if ncount = 0 then
msgbox "the active document contains no comments.", vbokonly, title
goto exithere
else
'stop if user not click yes
if msgbox("do want extract comments new document?", _
vbyesno + vbquestion, title) <> vbyes then
goto exithere
end if
end if
application.screenupdating = false
'create new document comments, base on normal.dot
set onewdoc = documents.add
'set landscape
onewdoc.pagesetup.orientation = wdorientlandscape
'insert 4-column table comments
onewdoc
.content = ""
set otable = .tables.add _
(range:=selection.range, _
numrows:=ncount + 1, _
numcolumns:=4)
end with
'insert info in header - change date format wish
onewdoc.sections(1).headers(wdheaderfooterprimary).range.text = _
"comments extracted from: " & odoc.fullname & vbcr & _
"created by: " & application.username & vbcr & _
"creation date: " & format(date, "mmmm d, yyyy")
'adjust normal style , header style
onewdoc.styles(wdstylenormal)
.font.name = "arial"
.font.size = 10
.paragraphformat.leftindent = 0
.paragraphformat.spaceafter = 6
end with
onewdoc.styles(wdstyleheader)
.font.size = 8
.paragraphformat.spaceafter = 0
end with
'format table appropriately
otable
.range.style = wdstylenormal
.allowautofit = false
.preferredwidthtype = wdpreferredwidthpercent
.preferredwidth = 100
.columns(1).preferredwidth = 5
.columns(2).preferredwidth = 25
.columns(3).preferredwidth = 50
.columns(4).preferredwidth = 20
.rows(1).headingformat = true
end with
'insert table headings
otable.rows(1)
.range.font.bold = true
.cells(1).range.text = "page"
.cells(2).range.text = "comment scope"
.cells(3).range.text = "comment text"
.cells(4).range.text = "author"
end with
'get info each comment odoc , insert in table
n = 1 ncount
otable.rows(n + 1)
'page number
.cells(1).range.text = _
odoc.comments(n).scope.information(wdactiveendpagenumber)
'the text marked comment
.cells(2).range.text = odoc.comments(n).scope
'the comment itself
.cells(3).range.text = odoc.comments(n).range.text
'the comment author
.cells(4).range.text = odoc.comments(n).author
end with
next n
application.screenupdating = true
application.screenrefresh
onewdoc.activate
msgbox ncount & " comments found. finished creating comments document.", vbokonly, title
exithere:
set odoc = nothing
set onewdoc = nothing
set otable = nothing
end sub
it works me in word 2011 on mac... part have in red used in title of 2 message boxes technically take out or change whatever want.
attached files:
Forums Macs Mac Apps and Mac App Store
- iPhone
- Mac OS & System Software
- iPad
- Apple Watch
- Notebooks
- iTunes
- Apple ID
- iCloud
- Desktop Computers
- Apple Music
- Professional Applications
- iPod
- iWork
- Apple TV
- iLife
- Wireless

No comments:
Post a Comment